Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio not showing installed Android api levels

I am developing an Android app in Visual Studio. In the Android SDK manager, all API's from API level 23 (Android 6.0) to API level 25 (Android 7.1) are installed.

But when I open the project properties in Visual Studio, the "Compile using Android version" option is showing apis only till 23(Android 6.0). I want to target 7.1 as most of the smartphones will now have it.

There are another problem if I go with Android 6.0. Some packages like Xamarin.Firebase.Messaging fails to install with the following error.

Install-Package: Could not install package 'Xamarin.Firebase.Messaging 42.1001.0'. 
You are trying to install this package into a 
project that targets 'MonoAndroid,Version=v6.0', but the package does not contain
any assembly references or content files that are 
compatible with that framework. For more information, contact the package author.

I can see that all options available under API level 25 are installed in SDK manager. Kindly help me so that i can target Android 7.1 from the Visual Studio Android app. Thanks

like image 294
It's a trap Avatar asked Jan 04 '23 14:01

It's a trap


1 Answers

Is your Xamarin installation up to date? I suspect that your version of Xamarin.Android is 6.x which means that you won't be able to target Android 7.0 or 7.1 even if they are installed through the SDK manager. You can check the version from Help > About Microsoft Visual Studio.

For example, my version is 7.1.0.19 and I'm able to target Androd 7.1 just fine.

To check for updates, you should open Tools > Options > Xamarin > Other and click Check now.


Update for Visual Studio 2017:

If you're using Visual Studio 2017 or newer, Xamarin updates are delivered as part of Visual Studio updates. To manually check for updates, go to Tools > Extensions and Updates... In the left hand menu, open Updates and select Product Updates. If there are updates available, they will be shown on this list.

Visual Studio 2017 update

like image 55
Timo Salomäki Avatar answered Jan 17 '23 05:01

Timo Salomäki