Chris Boot
Chris Boot

Reputation: 117

Building MAUI Android Failing

I created a brand new MAUI app (I had to create a new app as the previous app I'd created with a preview version didn't work when I upgraded Visual Studio preview). This app is using prism.maui which shouldn't make any difference and I'm also using a class library built with the preview version.

My app runs fine with Windows so I have no concern that I have issues with the app. I have also cleared out the obj folder multiple times with no joy.

When I build Android I get the following error message:

Error AMM0000 uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library D:\Code\AzureDevops\BootCom.Money.Xamarin\App\Money.App\obj\Debug\net6.0-android\lp\164\jl\AndroidManifest.xml as the library might be using APIs not available in 19 Suggestion: use a compatible library with a minSdk of at most 19, or increase this project's minSdk version to at least 21, or use tools:overrideLibrary="androidx.security" to force usage (may lead to runtime failures) Money.App D:\Code\AzureDevops\BootCom.Money.Xamarin\App\Money.App\obj\Debug\net6.0-android\AndroidManifest.xml 35

I know how to fix this - but even when I do I get a further issue:

AMM0000
Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from AndroidManifest.xml:24:18-86 is also present at AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:11:3-33:17 to override. Money.App D:\Code\AzureDevops\BootCom.Money.Xamarin\App\Money.App\obj\Debug\net6.0-android\AndroidManifest.xml 24

I really don't know where to go from here. I've recreated this app now 3 times and if this is how it needs to work for MAUI I need to go back to using Xamarin.

Please help!

Upvotes: 5

Views: 5088

Answers (2)

maximizer
maximizer

Reputation: 181

I had the same error after I added a package name via the properties of the project.

As a consequence of adding the package name via the options of the project, the AndroidManifest.xml package attribute was updated, wich is what is expected, but there was also a tag that was being added, wich was unwanted. The tag was the following:

<uses-sdk />

After removing this tag everything worked again.

Upvotes: 18

manlasiley
manlasiley

Reputation: 31

  • Go to androidManifest.xml file
  • add: uses-sdk android:minSdkVersion="21" if not exist otherwise update uses-sdk section to uses-sdk android:minSdkVersion="21" That solves my problem

Upvotes: 3

Related Questions