小工具知识网

当前位置: 首页 > 行业知识 > Androidstudio current target is 1.8 and ‘compileDebugKotlin‘ task (current target is 11)

行业知识

Androidstudio current target is 1.8 and ‘compileDebugKotlin‘ task (current target is 11)

2026-11-01 12:43:14 来源:互联网转载

升级AGP8.2.2

项目升级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

把所有配置修改成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.

项目中index.php/tags-602.html" >使用到kotlin的模块设置:

compileOptions {    sourceCompatibility JavaVersion.VERSION_17    targetCompatibility JavaVersion.VERSION_17}

同步项目,即可解决问题。

上一篇:教室预约系统源码深度解析,打造高效便捷的预约体验之旅

下一篇:用源码怎么做网站?