maui
maui copied to clipboard
.NET MAUI App Icon and Splash screen cannot be customized
Okay sooooo.. I ran into this same issue however, I've managed to get it working with my own custom app icon and well as my own custom splash screen. Albeit it's not an animated splash screen, I was getting the exact same issues described above.
What I did was this.
- Opened the Emulator and deleted the actual app from the device ( which I don't think was necessary)
- Renamed the old SVG files to splash_old.svg and appiconfg_old.svg respectively ( which I don't think was necessary)
- Added my custom splash.svg and appiconfg.svg files into their respective folders
- Edited the csproj file namely removing this
Color="#512BD4"
from this line<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg"/>
- Run a Rebuild Solution
- Run Build to Pixel 5 - API 33 (Android 13.0 - API 33)
Custom Icon:
Custom Splash Screen:
Hope this helps.
https://github.com/dotnet/maui/issues/10079#issue-1370643762
So what exactly is the issue? Your description doesn't say what you expect to happen or what is not working as you expected.
I've linked the original issue here as well as at the end of my post above.
I was having the exact same issue described in that post.
I was replying on that thread but for some reason I was asked to create a new issue and link it to the original thread which I did at the end of my post above.
I'll re-iterate here what the issue is and how to replicate it.
- Create a new .Net Maui app
- Build the Solution to Android Emulator
- Note the icon and splash screen
- Create a new custom splash.svg and appiconfg.svg files
- Rebuild the solution
- The original splash.svg and appiconfg.svg are still being shown
My original post above proposed a workaround to this issue as none was offered in the original thread.
Hope this clarifies what the issue is and how to circumvent it.
It would seem that during the Build process the csproj file is somewhat buggy as only when I edited the csproj file namely removing thisColor="#512BD4"
from this line <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg"/>
did it actually work by displaying my custom splash.svg and appiconfg.svg files.
Please go and read the original thread where this was reported on.
In step 5. Rebuild the solution, are you doing a rebuild with like a clean and build, or just running F5 again?
There may be an issue where the contents of the icon does not trigger a new image to be generated. But for a full rebuild, this should alway re-generate the images.
Hi @0nly1ken0bi. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
I think this PR will fix the splash screen since we now hash both the contents and the attibutes of splash screens: https://github.com/dotnet/maui/pull/10812
But, icons are just normal images with a special attribute so I may need to verify that there is somehting similar for images.
In step 5. Rebuild the solution, are you doing a rebuild with like a clean and build, or just running F5 again?
There may be an issue where the contents of the icon does not trigger a new image to be generated. But for a full rebuild, this should alway re-generate the images.
I used the Build/Rebuild Solution menu option which rebuilt the entire solution
I think this PR will fix the splash screen since we now hash both the contents and the attibutes of splash screens: #10812
But, icons are just normal images with a special attribute so I may need to verify that there is somehting similar for images.
Fingers crossed
Hi @0nly1ken0bi. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.
You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.
This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
Using Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.4.0 Preview 6.0
Half the problem seems to be fixed whereby the splash screen is working when changing the splash.svg
file to a custom file however, the App Icon remains unchanged.
Steps to duplicate issue:
- Open Visual Studio Community 2022 (64-bit) - Preview 2022 | Version 17.4 Preview 6.0
- Create new MAUI App and leave the defaults as is
- Build the Solution to Android Emulator i.e. Pixel 5 - API 33 (Android 13.0 - API 33)
- Note the App icon as being the default .Net purple and white icon
- Close Emulator
- Create a custom
appicon.svg
in the..Resource/AppIcon
folder and rebuild the app to the Android Emulator - Note that the default app icon hasn't changed on the device emulator which still shows the default .Net appicon.svg
- Close Emulator
- Edit the line in the csproj file
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
and delete theColor="#512BD4"
portion - . Build the Solution to Android Emulator i.e. Pixel 5 - API 33 (Android 13.0 - API 33)
- Note now that appicon on the emulator device now has your custom appicon.svg dispalyed
Only by editing the csproj does it allow you to display your custom app icon which eludes to the csprog file still being somewhat buggy.
Even when undoing the change in the csproj file after step 11 and reverting back to it's original form, the app icon doesn't change. (Only did this too see if anything would change)
Please follow the steps above to replicate the issue.