this version of the Java Runtime only recognizes class file versions up to 52.0 问题解决

java.lang.UnsupportedClassVersionError: com/xxx/xxx has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 问题解决

问题描述:

笔者在使用 sh 脚本自动编译Lib 打包 aar 的时候,Android Studio 老是报错:

java.lang.UnsupportedClassVersionError: com/xxx/xxx has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 问题解决

网上解决方案:

选择

Andrdoid Studio/Perferences/Gradle/Gradle JDK/Embedded JDK Version

但是笔者把里面的所有JDK 版本都选了,还是报错

实践方案:

在 gradle.properties 里加上这一句

org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home

上面写自己安装的JDK 目录,并且该目录是已经配置到系统环境变量里的

实践可行,特意记录下~

猜你喜欢

转载自blog.csdn.net/xiaobaaidaba123/article/details/129472913