Visual Studio not showing installed Android api levels

柔情痞子 提交于 2019-12-18 08:49:34

问题


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


回答1:


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.




回答2:


In Visual Studio 2017 preview there is an improved Google Android emulation support with a new Android emulator that's built into Visual Studio (this supercedes the Visual Studio Emulator for Android):

I checked it this morning and it had Android emulators up to API 27 including Oreo.

However, I did try to trigger API 28 P-Type even switching the SDK Manager from the Microsoft repository to the Google repository but it still didn't show up, but, at least you got everything you need up to API 27.

References:

  • https://www.visualstudio.com/vs/preview/
  • https://blog.xamarin.com/3-reasons-to-try-visual-studio-2017-version-15-4-previews/


来源:https://stackoverflow.com/questions/42105187/visual-studio-not-showing-installed-android-api-levels

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!