赞
踩
项目升级AGP,导致变异错误
* What went wrong:
Execution failed for task ':base:compileDebugKotlin'.
> 'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 11) jvm target compatibility should be set to the same Java version.
Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain
把所有配置修改成1.8
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
编译项目得到新的错误:
This project is configured to use an older Gradle JVM that supports up to version 11 but the current AGP requires a Gradle JVM that supports version 17.
也就是新as和AGP需要更高版本的jvm配置了。
打开as设置,编译jvm设置17.
项目中使用到kotlin的模块设置:
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
同步项目,即可解决问题。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。