Mono.AndroidTools.SdkNotSupportedException when trying to deploy to emulator

DanMiserDanMiser USMember ✭✭
edited April 8 in Xamarin.Android

I just installed VS2019 Mac. I have a Xamarin.Forms project that runs under Android. I right-click and select Options, and have the following options set:

  • General | Target Framework: Android 9.0 (Pie)
  • Android Application | Minimum Android version: Android 5.0 (API level 21)
  • Android Application | Target Android version: Android 9.0 (API level 28)

I select the Android project and this emulator that got created for me during VS install: Android_Accelerated_Nougat (API 25) and select the Play icon to deploy and debug the application on this emulator. During deploy, I end up with the exception below. Any ideas on how best to debug this. Any good, basic reference links would be welcome too, as this is the first time we're targeting Android.

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000:  Deployment failed
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000: Xamarin.AndroidTools.AndroidDeploymentException: SdkNotSupportedByDevice ---> Mono.AndroidTools.SdkNotSupportedException: The device does not support the minimum SDK level specified in the manifest.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000:   at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess (System.String output, System.String packageName) [0x00095] in /Users/builder/jenkins/workspace/monodroid-multibranch_d16-0-ROFMKET2X57L6OM33VV4CLSC53EGKYMXL7RAG3T2HOJWPTP3PQCA/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Internal/AdbOutputParsing.cs:329 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000:   at Mono.AndroidTools.AndroidDevice+<>c__DisplayClass95_0.<InstallPackage>b__0 (System.Threading.Tasks.Task`1[TResult] t) [0x00016] in /Users/builder/jenkins/workspace/monodroid-multibranch_d16-0-ROFMKET2X57L6OM33VV4CLSC53EGKYMXL7RAG3T2HOJWPTP3PQCA/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/AndroidDevice.cs:753 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000:   at System.Threading.Tasks.ContinuationTaskFromResultTask`1[TAntecedentResult].InnerInvoke () [0x00024] in <b4d1a66727f44ba888b54966284fabb4>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000:   at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2343 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000:    --- End of inner exception stack trace ---
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000:   at Xamarin.AndroidTools.AndroidDeploySession.InstallPackage () [0x0036a] in /Users/builder/jenkins/workspace/monodroid-multibranch_d16-0-ROFMKET2X57L6OM33VV4CLSC53EGKYMXL7RAG3T2HOJWPTP3PQCA/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:418 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000:   at Xamarin.AndroidTools.AndroidDeploySession.RunAsync (System.Threading.CancellationToken token) [0x003ae] in /Users/builder/jenkins/workspace/monodroid-multibranch_d16-0-ROFMKET2X57L6OM33VV4CLSC53EGKYMXL7RAG3T2HOJWPTP3PQCA/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:216 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000:   at Xamarin.AndroidTools.AndroidDeploySession.RunLoggedAsync (System.Threading.CancellationToken token) [0x0002f] in /Users/builder/jenkins/workspace/monodroid-multibranch_d16-0-ROFMKET2X57L6OM33VV4CLSC53EGKYMXL7RAG3T2HOJWPTP3PQCA/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:118 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0040: The device does not support the minimum SDK level specified in the manifest.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0040:   at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess (System.String output, System.String packageName) [0x00095] in /Users/builder/jenkins/workspace/monodroid-multibranch_d16-0-ROFMKET2X57L6OM33VV4CLSC53EGKYMXL7RAG3T2HOJWPTP3PQCA/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Internal/AdbOutputParsing.cs:329 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0040:   at Mono.AndroidTools.AndroidDevice+<>c__DisplayClass95_0.<InstallPackage>b__0 (System.Threading.Tasks.Task`1[TResult] t) [0x00016] in /Users/builder/jenkins/workspace/monodroid-multibranch_d16-0-ROFMKET2X57L6OM33VV4CLSC53EGKYMXL7RAG3T2HOJWPTP3PQCA/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/AndroidDevice.cs:753 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0040:   at System.Threading.Tasks.ContinuationTaskFromResultTask`1[TAntecedentResult].InnerInvoke () [0x00024] in <b4d1a66727f44ba888b54966284fabb4>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0040:   at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2343 

Answers

  • jezhjezh Member, Xamarin Team Xamurai

    Could you please post the content of manifest ?

  • AnandmauryaAnandmaurya INMember ✭✭
    edited April 8

    @DanMiser Minimum SDK version should be downloaded which is mention in your manifest file.
    if you are still facing the problem So select the Droid Project and go to the Properties.
    Then go to Android Options -> Advanced -> Add all supported architectures.
    and you can Enable Multi-Dex if you have big project.

  • DanMiserDanMiser USMember ✭✭

    In my Tools | SDK Manager, Android 5.0 - Lollipop is part checked because the only thing underneath it that is checked is Android SDK Platform 21. Android 7.1 - Nougat has these options checked, too:

    • Google APIs Intel x86 Atom_64 System Image
    • Google APIs ARM EAB v7a System Image

    I also have Android 8.1 and 9.0 part-checked, but they only have the SDK Platform checked underneath.

    Selecting Options | Android Build | Advanced, I have 4 Supported ABIs listed and all of them are checked: armeabi-v7a, x86, arm64-v8a, x86_64.

    I just tried enabling Enable Multi-Dex and that also did not work and yields the exact same stack trace.

    Here's my AndroidManifest.xml. Any other thoughts? Anyone else ever see anything like this? Google is not showing a lot of matches here. Thanks.

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.0.0" package="com.corp.myproject" android:versionCode="9">
        <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
        <uses-feature android:name="android.hardware.location" android:required="false" />
        <uses-feature android:name="android.hardware.location.gps" android:required="false" />
        <uses-feature android:name="android.hardware.location.network" android:required="false" />
        <uses-permission android:name="android.permission.CAMERA" />
        <uses-permission android:name="android.permission.FLASHLIGHT" />
        <uses-permission android:name="android.permission.BLUETOOTH" />
        <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
        <uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
        <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
        <application android:label="MyProject.Android"></application>
    </manifest>
    
  • DanMiserDanMiser USMember ✭✭

    In case anyone else hits this issue, it was caused by a blank <AndroidManifest></AndroidManifest> inside my Debug|Android configuration block in my csproj. It was created that way using the previous VS Mac IDE. There is another AndroidManifest element inside my main PropertyGroup, so deleting the blank one (or adding the path to AndroidManifest.xml here) makes the initial error go away.

  • jezhjezh Member, Xamarin Team Xamurai

    Congrats and thanks for sharing the answer.

  • SuchithSuchith INMember ✭✭✭

    @DanMiser That works!

Sign In or Register to comment.