Timothy Belvin
Timothy Belvin

Reputation: 83

Maui appicons incorrect on Android and iOS

I am trying to set my appicon in a Maui project. My icon is an svg that is 420x420.

It is in my csproj file like this:

<!-- <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" /> -->
<MauiIcon Include="Resources\AppIcon\logo_intro_icon.svg"  />

Note that I commented out the "default" icon the project template generated.

My AndroidManifest.xml looks like this (for the icon part):

<application android:allowBackup="true" android:icon="@mipmap/logo_intro_icon" android:supportsRtl="true" android:label="InnerMonk"></application>

On windows, the app icon looks as expected. On Android, it is too large and forced to be round. On iOS, I am still getting the default project template icon and not my custom icon for my app.

This is built on .NET 7. Just for giggles - I created a .NET 8 project and just tried to replace the appicon on the default project the template generates - same issue.

I also tried renaming my icon to appicon.svg, cleaning and rebuilding. Exactly same behavior.

Thanks in advance for your help.

Upvotes: 1

Views: 1309

Answers (1)

Liyun Zhang - MSFT
Liyun Zhang - MSFT

Reputation: 14469

I downloaded a svg image and tested it on the Visual Studio Preview 17.8.0 Preview 5.0.

  1. For the android, I can reproduce your problem. And according to the official document about the android app icon in the maui, you can try to use ForegroundScale="0.65" such as:
<MauiIcon Include="Resources\AppIcon\logo_intro_icon.svg" ForegroundScale="0.65" />
  1. For the iOS, I changed the value of XSAppIconAssets, such as:
<key>XSAppIconAssets</key>
<string>Assets.xcassets/logo_intro_icon.appiconset</string>

And the appicon changed successfully.

Note: I paired to Mac to test it on the ios and the environment on the Mac is : Visual Studio for Mac version 17.6 Preview and XCode version 15.0.1.

Upvotes: 2

Related Questions