严重性 代码 说明 项目 文件 行 禁止显示状态

错误 xamarin java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0

xama

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(3,3): Error: java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 (FGH)

 

SDK Build Tools Version: 24 rc2

The "Build Tools Version" looks like it might be the problem. Xamarin.Android is not yet compatible with the "24 rc2" Build-tools version from the "Preview Channel" in the Android SDK Manager. You can uninstall that preview version and install one of the non-preview versions of the Build-tools (such as 23.0.3) using the Android SDK Manager.



Update June 16, 2016:

The non-preview version of Android SDK Build-tools version 24 is now available in the Android SDK Manager. Xamarin.Android is not yet compatible with that version either.



Update July 14, 2016:

Unsupported major.minor version 52.0

It turns out this error message is caused by an incompatibility with the Java JDK rather than with Xamarin.Android: Android SDK Build-tools version 24 requires Java JDK 1.8, whereas earlier versions were still compatible with Java JDK 1.7. (This resembles ​​older answers​​ about the same error.)



Update July 25, 2016:

Google has now released Android SDK Build-tools 24.0.1. That version fixes a ​​bug in aapt​​ that was present in version 24. So you can now update to Build-tools 24.0.1 if desired, but you must also update to Java JDK 8.

Steps to update:

  1. Update to Java JDK 8.
  2. Install Android SDK Build-tools 24.0.1.
  3. (Optional) Uninstall the older Android SDK Build-tools 24 that contains the aapt bug:

Alternatives:

If you would rather not update to Java JDK 8 yet, you can instead do one of the following.

  • Uninstall all Android SDK Build-tools versions 24 and higher via the Android SDK manager.
  • Or set the AndroidSdkBuildToolsVersion MSBuild property to an earlier version. For example, if you also have version 23.0.3 installed, you could add the following line within the top <PropertyGroup> element in the Android project .csproj file:
    <AndroidSdkBuildToolsVersion>23.0.3</AndroidSdkBuildToolsVersion>