Issue
The Android SDK platform you are targeting only works with certain versions of Java. If you get this error, it means either:
- You don't have a Java SDK installed, or
- Your Java SDK version is too old or is otherwise not compatible with the targeted Android platform.
解决方案
Make sure you install a compatible JDK version, such as the Microsoft Build of OpenJDK.
注释
Java SDK 11.0 is required to use $(TargetFrameworkVersion) v12.0 (API-31) and later, and to use $(TargetFramework)=net6.0-android31.0 in .NET 6 and later.
Use of Java SDK 11.0 will break the Android Designer in Visual Studio 16.11 and earlier.
示例消息
error XA0031: Java SDK 11.0 or above is required when using $(TargetFrameworkVersion) v12.0.
Download the latest JDK at: https://aka.ms/msopenjdk
Note: the Android Designer is incompatible with Java SDK 11.0: https://aka.ms/vs2019-and-jdk-11