java.lang.IllegalArgumentException: Unsupported class file major version 61

电脑重新装了JDK17,之前的项目就跑不起来了,一直报错:如下

What went wrong:
Execution failed for task ':sdk:generateDebugRFile'.
> Could not resolve all files for configuration ':sdk:debugCompileClasspath'.
   > Failed to transform annotation-experimental-1.4.0.aar (androidx.annotation:annotation-experimental:1.4.0) to match attributes {artifactType=android-symbol-with-package-name, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-api}.
      > Execution failed for JetifyTransform: F:\whhnew\.gradle\caches\modules-2\files-2.1\androidx.annotation\annotation-experimental\1.4.0\c7a2038d831d0cfbfb9a440890b287c2e839ecf\annotation-experimental-1.4.0.aar.
         > Failed to transform 'F:\whhnew\.gradle\caches\modules-2\files-2.1\androidx.annotation\annotation-experimental\1.4.0\c7a2038d831d0cfbfb9a440890b287c2e839ecf\annotation-experimental-1.4.0.aar' using Jetifier. Reason: Unsupported class file major version 61. (Run with --stacktrace for more details.)
java.lang.IllegalArgumentException: Unsupported class file major version 61

指定JDK11,也不行

后来就把gradle版本升级:

distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-7.5-bin.zip
classpath 'com.android.tools.build:gradle:7.3.1'

就不报那个错误了,但是又报其他错误:

Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.22 (org.jetbrains.kotlin:kotlin-stdlib:1.8.22) and jetified-kotl

添加:

implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))

就好了,可以跑起来了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值