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>
Brandon Minnick
  • 13,342
  • 15
  • 65
  • 123
Marco
  • 56,740
  • 14
  • 129
  • 152
  • what does your manifest file look like? – Jason Mar 07 '21 at 15:12
  • 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. – Leo Zhu Mar 08 '21 at 01:53
  • @LeoZhu-MSFT it's already in my question: AppCenter doesn't recognize v11.0 as valid and can't compile. – Marco Mar 08 '21 at 05:21
  • Try to add `True` in the `.csproj` file. – Leo Zhu Mar 08 '21 at 07:16
  • @LeoZhu-MSFT: if I place that line, compilation is performed using v9.0 that is not compatible with my project – Marco Mar 08 '21 at 14:07
  • 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. – Anastasia Mar 10 '21 at 06:43
  • @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.2012 – Marco Mar 10 '21 at 06:48
  • You can leave a support ticket with this question. Please see this [guide](https://learn.microsoft.com/en-us/appcenter/help#accessing-app-center-free-support). – Anastasia Mar 10 '21 at 07:25
  • Thanks @Anastasia, I've just created a support ticket ;) – Marco Mar 10 '21 at 09:04
  • can you paste here your VS version and Xamarin.Android version – cahyo Mar 12 '21 at 12:51
  • @Marco Any news on this? The same problem here – Robert Apikyan Jul 14 '21 at 12:57
  • 1
    @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. – Justin Apr 06 '22 at 01:49

1 Answers1

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.