java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor versio

严重性 代码 说明 项目 文件 行 禁止显示状态
错误 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>
    

(See also https://releases.xamarin.com/technical-bulletin-android-sdk-build-tools-24/.)

引用自:http://stackoverflow.com/questions/36457947/java-lang-unsupportedclassversion-error-in-xamarin-studio/36458217

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
对于您遇到的`java.lang.UnsupportedClassVersionError: edu/hnuahe/lixu/HelloWorld : Unsupported major.minor version 52.0`错误,这是由于您正在尝试运行的Java类文件的版本与Java运行时环境(JRE)的版本不兼容所引起的。 这个错误通常发生在您正在使用一个较新版本的Java编译器(如Java 8)来编译您的代码,然后将该代码尝试在较旧版本的JRE(如Java 7)上运行。导致这种不兼容的原因是因为类文件的版本大于JRE所能识别的版本。 要解决这个问题,您可以尝试以下几个步骤: 1. 确保您正在使用与您的JRE版本相匹配的Java编译器来编译您的代码。如果您的JRE版本是Java 8,则应使用Java 8编译器。 2. 确认您的JRE版本是否支持您要运行的Java类文件的版本。在这种情况下,版本号52.0表示您的Java类文件是使用Java 8编译的。 3. 如果您的JRE版本较旧且不支持Java 8编译的类文件,则可以尝试升级您的JRE版本以与您的类文件兼容。 4. 如果您无法升级JRE版本,您可以尝试通过使用较旧版本的Java编译器重新编译您的代码,以便生成与您的JRE版本兼容的类文件。 总结一下,要解决`java.lang.UnsupportedClassVersionError: edu/hnuahe/lixu/HelloWorld : Unsupported major.minor version 52.0`错误,您需要确保您的Java类文件版本与您的JRE版本兼容。您可以通过升级JRE版本或重新编译代码来解决此问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值