Matthew Pans
Matthew Pans

Reputation: 839

MAUI: 'Controls' could not be found and mipmap/appicon_round not found

I am getting below errors when rebuilding the app in release mode before creating APK file.

Severity Code Description Project File Line Suppression State Error APT2067 failed processing manifest. MyProjectName C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.43\tools\Xamarin.Android.Aapt2.targets 214

Severity Code Description Project File Line Suppression State Error APT2260 resource mipmap/appicon (aka com.companyname.MyAppName:mipmap/appicon) not found.

This error is likely caused by an issue with the AndroidManifest.xml file or an Android manifest generation attribute in a source code file. MyProjectName E:\My Projects\MAUI\MyProjectName\MyProjectName\Platforms\Android\AndroidManifest.xml 1

Severity Code Description Project File Line Suppression State Error APT2260 resource mipmap/appicon_round (aka com.companyname.MyAppName:mipmap/appicon_round) not found.

This error is likely caused by an issue with the AndroidManifest.xml file or an Android manifest generation attribute in a source code file. MyProjectName E:\My Projects\MAUI\MyProjectName\MyProjectName\Platforms\Android\AndroidManifest.xml 1

Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'Controls' could not be found (are you missing a using directive or an assembly reference?) MyProjectName (net8.0-android) E:\My Projects\MAUI\MyProjectName\MyProjectName\MainPage.xaml.cs 1 Active

I tried adding the appicon and appicon_round under Platforms/Android/Resources/mipmap, but no luck.

I am using Controls.UserDialogs.Maui - 1.3.0 for showing the userdialogs and due to that the last error is showing: The type or namespace name 'Controls' could not be found. I tried updating it to 1.5.0 but no luck.

My .Net version was 7 and I tried to update it to 8.

My VS(Windows) version is 17.9.0 Preview 1.0 also I tried on 17.8.1.

I tried creating a demo project with this issue, but in that there is no such issue.

Upvotes: 0

Views: 1121

Answers (1)

Liyun Zhang - MSFT
Liyun Zhang - MSFT

Reputation: 14434

resource mipmap/appicon_round (aka com.companyname.MyAppName:mipmap/appicon_round) not found.

You can delete the android:roundIcon="@mipmap/appicon_round" in the \Platforms\Android\AndroidManifest.xml to resolve it. For more information, you can refer to my old answer about changing the app icon for android.

I am using Controls.UserDialogs.Maui - 1.3.0 for showing the userdialogs and due to that the last error is showing: The type or namespace name 'Controls' could not be found.

The Controls.UserDialogs.Maui doesn't support the Windows platform. So make sure the target platform is not windows. Such as target android:

enter image description here

And then, you can use Controls.UserDialogs.Maui.UserDialogs.

Update:

Change the appicon in the maui:

Delete the default icon file and rename your icon file as appicon.svg in the Resources\AppIcon folder. Then the appicon will be changed.

Or Delete the default icon file and put your icon file in the Resources\AppIcon folder and set its build action as MauiIcon such as myicon.svg.

And in the csproj, you will find:

<MauiIcon Include="Resources\AppIcon\myicon.svg" />

And then change the icon in the \Platform\Android\AndroidManifest:

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

Don't forget to delete the android:roundIcon="@mipmap/appicon_round".

Upvotes: 2

Related Questions