Edit

Share via


.NET for Android error XA0031

Issue

The Android SDK platform you are targeting only works with certain versions of Java. If you get this error, it means either:

  1. You don't have a Java SDK installed, or
  2. Your Java SDK version is too old or is otherwise not compatible with the targeted Android platform.

Solution

Make sure you install a compatible JDK version, such as the Microsoft Build of OpenJDK.

Note

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.

Example messages

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