error APT2263: unexpected element <queries> found in <manifest>
Asked Answered
G

1

6

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>
Griffe answered 7/3, 2021 at 14:15 Comment(12)
what does your manifest file look like?Afterwards
Did you try to set the Target Framewokr and the targetSdkVersion to android 11(right the android project and set in properties) ,then compile with v11.0.Bombazine
@LeoZhu-MSFT it's already in my question: AppCenter doesn't recognize v11.0 as valid and can't compile.Griffe
Try to add <AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk> in the .csproj file.Bombazine
@LeoZhu-MSFT: if I place that line, compilation is performed using v9.0 that is not compatible with my projectGriffe
Did you try to clean the cache? Could you please try to clean the project, remove bin and debug folders. Relaunch your project and restore packages? Also could you please clarify does it happens on an empty project too? What the version of Xamarin.Forms project are you use? I checked this behavior on an empty project with the latest version of VS and for me all work well.Inconsistency
@Anastasia: I've already tried what you say, but without any luck. Please note that the project can compile on my pc withoout any trouble, but it still fails in AppCenter (problem I need to solve). Xamarin.Forms v5.0.0.2012Griffe
You can leave a support ticket with this question. Please see this guide.Inconsistency
Thanks @Anastasia, I've just created a support ticket ;)Griffe
can you paste here your VS version and Xamarin.Android versionAnesthesiologist
@Griffe Any news on this? The same problem herePolysaccharide
@LeoZhu-MSFT Setting AndroidUseLatestPlatformSdk to true isn't a good suggestion, as this setting is deprecated and gets automatically removed whenever you run an Android project within VS for Mac.Veery
S
0

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.

Sidonia answered 22/9, 2022 at 5:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.