Reputation: 1195
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
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
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
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
Reputation: 2719
I use the JetBrains Rider IDE. My tried-and-true workaround is:
android:icon="@mipmap/appicon"
part from AndroidManifest.xml
android:icon="@mipmap/appicon"
back to AndroidManifest.xml
This might work just as well in Visual Studio.
Upvotes: 1
Reputation: 11
Solution that worked for me was to clean all and then rebuild solution.
Upvotes: 1
Reputation: 21
The way that worked for me was to:
I saw that workaround here:
Hope this could help.
Upvotes: 2
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
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
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
Reputation: 1
This issue is sure in new created project.
It resolve this "missing file reference" rename example "dotnet_bot.svg" -> to appicon.svg
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
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:
bin
and obj
folders.Visual Studio for Mac
.Build
-> Build solution
.Upvotes: 32
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 ...
AndroidManifest.xml
AppIcon
SVG file(s) and put them in the correct folder.AndroidManifest.xml
Upvotes: 21