0

I am trying to change the app icon in a MAUI project but I am unable to do it.

I have added two images to the AppIcon folder ( I tried png and svg but none of them work)

And changed the csproj file to the new icons

<MauiIcon Include="Resources\AppIcon\coolcoicon.svg" ForegroundFile="Resources\AppIcon\coolcoiconbg.svg" Color="#000000" />

I have cleaned the solution and the project.

However, when I try to play the app in the android emulator I have these error

Error   APT2260 resource mipmap/appicon (aka com.coolco.coolcoapp:mipmap/appicon) not found.
Error   APT2260 resource mipmap/appicon_round (aka com.coolco.coolcoapp:mipmap/appicon_round) not found.
Error   APT2067 failed processing manifest.

Error

Coolco
  • 3
  • 1
  • 3
  • 1
    Quick way to solve your problem, is to replace the default file, and not make up random names for icons. If you want to be creative anyway, you will need to learn how icons work for both platforms. Good place to start: https://learn.microsoft.com/en-us/dotnet/maui/user-interface/images/app-icons?view=net-maui-7.0&tabs=android – H.A.H. Mar 07 '23 at 11:28

1 Answers1

4

Please check the AndroidManifest.xml in the /Platforms/Andorid. And there is such one line code in it:

 <application ... android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" ...>

When you change the Appicon in the project's csproj file. You also need to change this line for the android. Such as:

 <application ... android:icon="@mipmap/coolcoicon" ...>

The android:roundIcon only used for the android 7.1. And you can delete it directly. I have tested this, and the app icon changed successfully.

You can also set the icon's file name as the default like H.A.H said.

Liyun Zhang - MSFT
  • 8,271
  • 1
  • 2
  • 14