Unsupported major.minor version 52.0

本文介绍了解决Cocos编译Android项目时出现的UnsupportedClassVersionError异常的方法。该异常通常由于编译时使用的JDK版本高于目标平台版本引起。文章提供了通过指定build-tools版本及调整Eclipse中JDK版本设置来解决问题的具体步骤。

今天cocos 编译android项目的时候,遇到这样的异常。

[dex] Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0

这个是因为编译的时候,使用的jdk 版本比目标平台的jdk版本高导致,52.0说明编译版本是J2SE 8(JDK 1.8)。我检查了一下javac 和 jre的版本(javac -version和java -version),发现都是1.7的。

后来记起来,前几天更新了build-tools。

如果,项目在project.properties中未指定使用哪个版本的build-tools,那么他会选择最新的。在我的android sdk目录下的build-tools下,有三个版本,最高是25.0.2,我在porject.properties中加入:

sdk.buildtools=19.1.0

指定了build-tools的版本,然后再cocos compile,打包成功。

如果用eclipse的话,可以去设置java compile,把jdk version 从1.8设置为1.7。

转载于:https://www.cnblogs.com/pixs-union/p/6554912.html

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [E:\BJJGSWGLJ\hd\wisdom-city-common\target\classes\com\louddt\asset\wisdom\entity\common\dict\Dict.class]; nested exception is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [E:\BJJGSWGLJ\hd\wisdom-city-common\target\classes\com\louddt\asset\wisdom\entity\common\dict\Dict.class]; nested exception is java.lang.IllegalArgumentException: Unsupported class file major version 61 at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:452) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:315) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:276) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:132) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:296) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:250) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:207) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationCl
最新发布
08-01
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值