error APT2263: unexpected element <queries> found in <manifest>

Viewed 1848

First I beg your pardon if the problem sounds silly, but I'm a newbie in Xamarin.Forms development.
I created my first app (with a lot of efforts) and I decided to use AppCenter to deploy debug releases to my testers.
Everything went fine till the last month, when I updated packages (dependencies), removed some deprecated one and pushed changes to GIT: from that moment AppCenter can't compile my app anymore, app that's compiled properly on my pc.

If I compile using v10.0 this is the error I get:

/Users/runner/work/1/s/src/StamuraApp/StamuraApp.Android/StamuraApp.Android.csproj" (PackageForAndroid target) (1) -> (_CreateBaseApkWithAapt2 target) -> /Users/runner/work/1/s/src/StamuraApp/StamuraApp.Android/obj/Release/android/manifest/AndroidManifest.xml(31): error APT2263: unexpected element <queries> found in <manifest>. [/Users/runner/work/1/s/src/StamuraApp/StamuraApp.Android/StamuraApp.Android.csproj]

If I try to compile using v11.0 I get the error:

/Users/runner/work/1/s/src/StamuraApp/StamuraApp.Android/StamuraApp.Android.csproj" (PackageForAndroid target) (1) -> (_ResolveSdks target) -> /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(819,2): error XA0000: Could not determine API level for $(TargetFrameworkVersion) of 'v11.0'. [/Users/runner/work/1/s/src/StamuraApp/StamuraApp.Android/StamuraApp.Android.csproj]

So I understand that AppCenter can't use v11.0, but I don't know what to do with the error. I searched other questions and most of them talk about Gradle version, but I don't know how to set it in Visual Studio.
AppCenter warns me that

Usage of Android Gradle Plugin 4.1.0+ is not supported at the moment. Please use any of the earlier versions.

but I don't know how I can solve it.
Is there a way I can fix the issue?

EDITED
My manifest is this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="156" android:versionName="1.10.6" package="com.sefstamura.stamuraapp" android:installLocation="auto">
    <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="29" />
    <uses-permission android:name="android.permission.INTERNET" />
    <!-- Push notifications
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
  ****************** -->
    <application android:label="StamuraApp" android:fullBackupContent="@xml/appcenter_backup_rule">
        <!-- File provider -->
        <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data>
        </provider>
    </application>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.USE_FINGERPRINT" />
</manifest>
1 Answers

Faced the same issue when I tried to Upgrade My FormsApp to use XamarinForms to 5.0.

Please make sure to install the latest SDK versions on your machine i.e in my case Android 11[API 30]and corresponding build tool versions. Also, upgrade the VisualStudio to the latest version where the XamarinAndroidSDK version in turn updated to pick the API level it supports.

Related