How can I target Android 4.1 in Visual Studio 2019?

会有一股神秘感。 提交于 2020-02-25 06:07:21

问题


I have VS2017 and VS2019 installed side by side on my Windows 10 machine.

I can not compile Xamarin Android 4.1 projects (in VS2019) unless I upgrade them to 4.4 which seems to be the minimum Android SDK version I can target in VS2019. VS2017 compiles fine.

If I create a new Xamarin Android project in VS2019 I can select from 4.4 and above, but in VS2017 I can target right back to 2.3. Both Visual Studio Xamarin settings are pointing to the same location for the android-sdk (which is on my D: drive, but I did copy it to the standard install location to verify it was not using this as a default, which made no difference)

VS2019 Minimum Android Version

VS2017 Minimum Android Version

Is it possible to target Android 4.1 using VS2019?


回答1:


Use the following when making decisions with your Android versions:

minSdkVersion (lowest possible) <= 
    targetSdkVersion == compileSdkVersion/TargetFrameworkVersion (latest SDK)

It's also worthwhile to consider the Android Dashboard to understand how many devices are running a specific version of Android.

https://developer.android.com/about/dashboards




回答2:


Selecting a higher "Compile using Android version" still lets the project compile.

Under the Android Manifest tab, you can still select the older Minimum and Target Android version allowing VS2019 to be used with this solution/project that uses an older Target Version.

Per the tooltip, Target Framework is only used at runtime.



来源:https://stackoverflow.com/questions/55945365/how-can-i-target-android-4-1-in-visual-studio-2019

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