maui icon indicating copy to clipboard operation
maui copied to clipboard

.NET MAUI App Icon and Splash screen cannot be customized

Open 0nly1ken0bi opened this issue 1 year ago • 7 comments

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.

  1. Opened the Emulator and deleted the actual app from the device ( which I don't think was necessary)
  2. Renamed the old SVG files to splash_old.svg and appiconfg_old.svg respectively ( which I don't think was necessary)
  3. Added my custom splash.svg and appiconfg.svg files into their respective folders
  4. Edited the csproj file namely removing this Color="#512BD4" from this line <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg"/>
  5. Run a Rebuild Solution
  6. Run Build to Pixel 5 - API 33 (Android 13.0 - API 33)

Custom Icon:

Custom_Icon

Custom Splash Screen:

Custom Splash

Hope this helps.

https://github.com/dotnet/maui/issues/10079#issue-1370643762

0nly1ken0bi avatar Oct 26 '22 23:10 0nly1ken0bi

So what exactly is the issue? Your description doesn't say what you expect to happen or what is not working as you expected.

activa avatar Oct 27 '22 02:10 activa

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.

  1. Create a new .Net Maui app
  2. Build the Solution to Android Emulator
  3. Note the icon and splash screen
  4. Create a new custom splash.svg and appiconfg.svg files
  5. Rebuild the solution
  6. 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.

0nly1ken0bi avatar Oct 27 '22 12:10 0nly1ken0bi

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.

mattleibow avatar Oct 27 '22 18:10 mattleibow

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.

msftbot[bot] avatar Oct 27 '22 18:10 msftbot[bot]

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.

mattleibow avatar Oct 27 '22 18:10 mattleibow

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

0nly1ken0bi avatar Oct 28 '22 15:10 0nly1ken0bi

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

0nly1ken0bi avatar Oct 28 '22 15:10 0nly1ken0bi

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.

msftbot[bot] avatar Nov 03 '22 23:11 msftbot[bot]

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:

  1. Open Visual Studio Community 2022 (64-bit) - Preview 2022 | Version 17.4 Preview 6.0
  2. Create new MAUI App and leave the defaults as is
  3. Build the Solution to Android Emulator i.e. Pixel 5 - API 33 (Android 13.0 - API 33)
  4. Note the App icon as being the default .Net purple and white icon
  5. Close Emulator
  6. Create a custom appicon.svg in the ..Resource/AppIcon folder and rebuild the app to the Android Emulator
  7. Note that the default app icon hasn't changed on the device emulator which still shows the default .Net appicon.svg
  8. Close Emulator
  9. Edit the line in the csproj file <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" /> and delete the Color="#512BD4" portion
  10. . Build the Solution to Android Emulator i.e. Pixel 5 - API 33 (Android 13.0 - API 33)
  11. 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.

0nly1ken0bi avatar Nov 08 '22 15:11 0nly1ken0bi