'kaptgeneratestubsdebugkotlin'任务(当前目标是17)

bgibtngc  于 2023-06-24  发布在  Kotlin
关注(0)|答案(2)|浏览(307)

'compiledebugjavawithjavac' task (current target is 1.8) and 'kaptgeneratestubsdebugkotlin' task (current target is 17) jvm target compatibility should be set to the same java version.
我这样解决这个问题

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KaptGenerateStubs).configureEach{
kotlinOptions{jvmTarget = "1.8"}
}

configuration line rendered

zxlwwiss

zxlwwiss1#

如果遇到类似的问题,必须在Build.Grade(app)中添加此代码

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KaptGenerateStubs).configureEach{kotlinOptions{jvmTarget = "1.8"}}
stszievb

stszievb2#

allprojects{
   tasks.withType(org.jetbrains.kotlin.gradle.tasks.KaptGenerateStubs).configureEach{
    kotlinOptions{
        jvmTarget= JavaVersion.VERSION_1_8
    }
  }
}

相关问题