-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to set Maui icon to a PNG file [Android] #27061
Comments
You probably want to remove this section and try again. Also, I don't think |
@jfversluis Oops, thanks for pointing that Remove part out! I've updated my repository. It still gives the same error though, and I've also removed the MauiRoundIcon bit too. |
The As @jfversluis was mentioning there is no First define your icon's in csproj correctly <MauiIcon Include="Resources\AppIcon\location_darkblue.png" /> Then update the <application android:allowBackup="true"
android:icon="@mipmap/location_darkblue"
android:roundIcon="@mipmap/location_darkblue_round"
android:supportsRtl="true">
</application> Clean and Rebuild. Everything was mentioned in documentation here. |
Oh good catch @bhavanesh2001 thank you! That indeed should be it :) Let us know if that works! |
@bhavanesh2001 Thanks for your input. I thought that "@mipmap/appicon" was in effect a placeholder and would be replaced with the name of the first MauiIcon declared in the project file? (and similar for the roundIcon). In my actual app (as opposed to the demo in the repository) I have multiple MauiIcons, using Condition="'$(Configuration)'=='Testing'" etc in the project file for different configurations as I have different icons for Release, Testing and Training. I don't believe I can do similar in the AndroidManifest.xml file? |
@Mark-NC001 I don' t think this is the case ... But I understand the need of having different Icon's based upon Configuration. I will suggest a simple solution which doesn't include changing you
<MauiIcon Condition="'$(Configuration)' == 'RELEASE'" Include="Resources\AppIcon\Release\location_darkblue.png" ForegroundScale="0.65" Generate="True" />
<MauiIcon Condition="'$(Configuration)' == 'DEBUG'" Include="Resources\AppIcon\Debug\location_darkblue.png" ForegroundScale="0.65" Generate="True" />
<MauiIcon Condition="'$(Configuration)' == 'TEST'" Include="Resources\AppIcon\Test\location_darkblue.png" ForegroundScale="0.65" Generate="True" /> Clean and Rebuild. |
@bhavanesh2001 thank you for your suggestion, I've done it that way and it works well! I think I probably made an incorrect assumption as there was no file extension in the android manifest for appicon. |
Description
I have a Maui project that targets Android. I am not using SVG files, but when I try and set my MauiIcon to a PNG file, I get the following errors:
APT2067 failed processing manifest
APT2260 resource mipmap/appicon (aka uk.police.norfolk.forceformsdebug:mipmap/appicon) not found.
Steps to Reproduce
Open the linked repository.
Notice in the proj file, I have the following MauiIcon and MauiRoundIcons set:
Notice that I have removed the bit:
android:roundIcon="@mipmap/appicon_round"
in the AndroidManifest.xml.
Link to public reproduction project repository
https://github.com/Mark-NC001/TestMauiAndroidIcon
Version with bug
9.0.22 SR2.2
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
No response
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
The text was updated successfully, but these errors were encountered: