Chris Simeone
Chris Simeone

Reputation: 1195

Building Maui MS Tutorial App: Get error APT2260: resource mipmap/appicon and mipmap/appicon_round not found

Most of the posts I found related to this issue were created when Maui was still in beta.
This issue affected the Android build only! The iOS build worked the first time.

Following this Microsoft Maui tutorial, I experienced a build issue right out the gate. The error was APT2260: resource mipmap/appicon and mipmap/appicon_round not found.

In the resources folder there was no appicon_round.svg file, so I copied appicon.svg to appicon_round.svg and tried a rebuild and got the same error.

I deleted android:roundIcon="@mipmap/appicon_round" from AndroidManifest.xml, and deleted the appicon_round.svg file I created via a copy action, but the build still failed.

Even though appicon.svg did exist, I removed android:icon="@mipmap/appicon" from AndroidManifest.xml, and the rebuild was successful. 🤦🏻‍♂️

Finally, I used Inkscape to create appicon_round.svg, I added it to the projects Resources/AppIcon folder, and then added android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" back to the AndroidManifest.xml file. The following build was successful.

First thing to note is that, while Visual Studio 2022 for MacOS did create the appicon.svg file, it did not generate the appicon_round.svg when I created the Multi-Platform project.

The second "gotcha" for me was when I removed the round SVG reference from the Android manifest file, but the build still failed.

Upvotes: 37

Views: 24488

Answers (12)

Omar Alshobky
Omar Alshobky

Reputation: 29

In short, add the image name to your manifest android:icon="@mipmap/appicon" part from AndroidManifest.xml Upload the appicon and replace it with the image name

Upvotes: 0

Ricardo Veloz
Ricardo Veloz

Reputation: 19

in .csproj

<MauiIcon Include="Resources\AppIcon\icono.png" ForegroundFile="Resources\AppIcon\icono.png" Color="#FFFFFF" />
<MauiRoundIcon Include="Resources\AppIcon\ic_launcher.png" ForegroundFile="Resources\AppIcon\ic_launcher.png" Color="#FFFFFF" />

And put those images in /Resources/AppIcon folder

Upvotes: 0

BillF
BillF

Reputation: 1126

This is still happening for me, every time I delete bin/obj and clean the solution (which is many times per day, of necessity).

When that happens, I get around it by NOT closing the solution, NOT deleting bin/obj at the same time, and immediately cleaning the solution then rebuilding.

Upvotes: 0

CFL_Jeff
CFL_Jeff

Reputation: 2719

I use the JetBrains Rider IDE. My tried-and-true workaround is:

  1. Delete the android:icon="@mipmap/appicon" part from AndroidManifest.xml
  2. Rebuild Solution
  3. Add android:icon="@mipmap/appicon" back to AndroidManifest.xml
  4. Rebuild Solution again

This might work just as well in Visual Studio.

Upvotes: 1

Chis
Chis

Reputation: 11

Solution that worked for me was to clean all and then rebuild solution.

Upvotes: 1

Daniel Pinder
Daniel Pinder

Reputation: 21

The way that worked for me was to:

  1. Unistall the app on the target platform
  2. Clean the solution.
  3. Build the solution.

I saw that workaround here:

https://learn.microsoft.com/en-us/dotnet/maui/user-interface/images/app-icons?view=net-maui-8.0&tabs=windows

image from url link

Hope this could help.

Upvotes: 2

Alexandr  Meshkov
Alexandr Meshkov

Reputation: 136

After updating net7-android to net8-android I started getting the same error. After I updated the nuget packages Microsoft.Maui.Controls and Microsoft.Maui.Controls.Compatibility to version 8.0.6, after which the build went without errors.

Perhaps removing these packages and reinstalling them with version 8.0.3 will help too. Because on my other computer this same project builds normally with versions 8.0.3.

P.S. before this I cleaned out the bin and obj folders

Upvotes: 2

gerhard
gerhard

Reputation: 389

I changed

<MauiIcon Include="Resources\AppIcon\appiconx.png" />

to a not existing file, build, get another error message, changed it back to the original filename and build again. No errors any more.
No choke! (VS 17.8.3, dotnet 8.0.100, target runtime net8.0)

Upvotes: 25

Carlos
Carlos

Reputation: 1822

First of all: do not touch AndroidManifest.xml, it is not needed. The problem was in my project file, I had the comment <!-- App Icon --> but nothing under it.

So, fill your icon information under it:

<MauiIcon Include="Resources\AppIcon\appicon.png" />

Be sure it is inside a <ItemGroup></ItemGroup>

Then you have to clear and build your solution and uninstall the app in the mobile device and install it again.

Upvotes: 0

Martin McDermot
Martin McDermot

Reputation: 1

This issue is sure in new created project.

It resolve this "missing file reference" rename example "dotnet_bot.svg" -> to appicon.svg

  • and now it works and can be build without errors

My solution it works - image

Code:

<ItemGroup>
    <!-- App Icon -->
    <MauiIcon Include="Resources\AppIcon\appicon.svg" Color="#FFFFFF" ForegroundScale="0.5" />
    <!-- Images -->
    <MauiImage Include="Resources\Images\*" />
    <MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />
    <MauiImage Update="Resources\Images\appicon.svg" />
    <!-- Custom Fonts -->
    <MauiFont Include="Resources\Fonts\*" />

Upvotes: 0

R23
R23

Reputation: 623

Sometimes I face the same build error while trying to deploy MAUI app to Android device in Release mode via Visual Studio for Mac.

The solution that works in my case is also simple:

  1. Manually delete project's bin and obj folders.
  2. Restart Visual Studio for Mac.
  3. Open app's project.
  4. Build -> Build solution.

Upvotes: 32

Chris Simeone
Chris Simeone

Reputation: 1195

To summarize how to resolved the issue, if you generate a multi-platform project in Visual Studio 2022 for MacOS and any AppIcon SVG files are missing ...

  1. Remove both/all AppIcon references from the AndroidManifest.xml
  2. Build the app.
  3. Generate the missing AppIcon SVG file(s) and put them in the correct folder.
  4. Add both/all AppIcon references back to the AndroidManifest.xml
  5. Build the app.

Upvotes: 21

Related Questions