具体报错信息如下:
'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17)
jvm target compatibility should be set to the same Java version.
很显然,这是一个版本冲突问题,compileDebugJavaWithJavac版本是1.8,compileDebugKotlin是17。我们只需将这两个版本改成同一个即可,在build.gradle中添加以下代码:
kotlinOptions {
jvmTarget = "1.8"
}
如下图所示: