0
votes

While creating a new Prism for Xamarin.Forms project with VS2017 I'm getting the following errors:

Could not find android.jar for API Level . This means the Android SDK platform for API Level is not installed. Either install it in the Android SDK Manager (Tools > Open Android SDK Manager...), or change your Xamarin.Android project to target an API version that is installed. (C:\Users\yoav\AppData\Local\Android\sdk\platforms\android-\android.jar missing.) BlankApp3.Android

Error NU1202 Package Xamarin.Android.Support.Design 27.0.2.1 is not compatible with monoandroid80 (MonoAndroid,Version=v8.0). Package Xamarin.Android.Support.Design 27.0.2.1 supports: monoandroid81 (MonoAndroid,Version=v8.1)

Error NU1202 Package Xamarin.Android.Support.v4 27.0.2.1 is not compatible with monoandroid80 (MonoAndroid,Version=v8.0). Package Xamarin.Android.Support.v4 27.0.2.1 supports: monoandroid81 (MonoAndroid,Version=v8.1)

Error NU1202 Package Xamarin.Android.Support.v7.AppCompat 27.0.2.1 is not compatible with monoandroid80 (MonoAndroid,Version=v8.0). Package Xamarin.Android.Support.v7.AppCompat 27.0.2.1 supports: monoandroid81 (MonoAndroid,Version=v8.1)

Error NU1202 Package Xamarin.Android.Support.v7.CardView 27.0.2.1 is not compatible with monoandroid80 (MonoAndroid,Version=v8.0). Package Xamarin.Android.Support.v7.CardView 27.0.2.1 supports: monoandroid81 (MonoAndroid,Version=v8.1)

Error NU1202 Package Xamarin.Android.Support.v7.MediaRouter 27.0.2.1 is not compatible with monoandroid80 (MonoAndroid,Version=v8.0). Package Xamarin.Android.Support.v7.MediaRouter 27.0.2.1 supports: monoandroid81 (MonoAndroid,Version=v8.1)

Can anyone please tell me how to avoid such errors?

1
1) Do you have the Android API 8.1 SDK installed (as per stated in the first error), ideally you should have Oreo/9 installed and set your project's compile target to that. 2) The project is trying to restore the android support packages for Android 8.1 but your project is set to a Xamarin Android Compile target of 8.0 (stackoverflow.com/questions/49246580/…)SushiHangover
1, Make sure you have installed API 8.1 SDK. 2, Set your target version and compile version both to API8.1. If it still does not work, clean solution, then delete the bin and obj folders under your project and then rebuild solution.AbbyWang - MSFT

1 Answers

1
votes

The error you are getting is quite clear about the problem. You are trying to use the Android Support packages for API version 27 which would be Android 8.1, while targeting Android 8.0. You have a couple of options:

  1. Ensure that you have the 8.1 SDK installed on your machine and re-target your Android project to 8.1.

  2. Downgrade the Android Support packages to 26.1.0.1

  3. Upgrade the Android Support packages to 28.0.0.1 as the Xamarin.Android team now cross compiles the Android Support libraries to support Android projects that are targeting older SDK versions back to 6.0.