Hi Renesh Raj!
I have looked at your provided code, here are some potential problems I can give:
On Android:
The main reasons are:
- SVG Format Issues: The
appicon.svg
file itself might have an unsupported element or be formatted in a way that the MAUI build system's vector-to-drawable converter doesn't understand. A common issue is using a complex SVG with gradients or filters that are not supported. - Build Issues: Sometimes, a clean and rebuild of the solution is needed to force the build process to regenerate the icon assets.
- Broken SVG draw: Check if your
appicon.svg
has an appropriate path for size. You can check this by using Android Asset Studio - import your SVG file and see if it's correctly displayed.
On iOS:
Your Info.plist file has this key:
<key>XSAppIconAssets</key><string>Assets.xcassets/appicon.appiconset</string>
The most likely reason for the default .NET icon on iOS is that the Assets.xcassets/appicon.appiconset
folder is either not being generated correctly, or the files inside are missing or corrupted.
These issues all point back to a potential issue with the source
appicon.svg
file or a build process failure.
Solutions
- Check your SVG file: Open your
Resources\AppIcon\appicon.svg
file in a text editor. Ensure it is a simple, clean SVG. Complex elements like gradients, transforms, or filters can cause build failures. A good test is to simplify the SVG to a basic shape and color, then try rebuilding. If it works, the issue is with your original SVG's complexity. - Clean and Rebuild the Project: This is a crucial step. Right-click on your project in Visual Studio and select Clean. Then, right-click and select Rebuild. This forces the MAUI build system to re-process all assets from scratch.
- Try a different SVG: If the above steps fail, try replacing your
appicon.svg
with a very basic, known-good SVG, like a simple circle or square. If this works, it confirms that your original SVG is the root cause. - Check for Caching Issues: On the device or emulator, sometimes the old icon is cached. Try uninstalling the app completely from the device before redeploying.
By following these steps, you can pinpoint whether the issue is with your source SVG, the build process, or a caching problem on the device. The most common culprit is a problem with the SVG file itself.
I hope this help! Let me know if you stuck anywhere else so I can assist you!