发现代码中没有17
compileOptions {
sourceCompatibility(JavaVersion.VERSION_11)
targetCompatibility(JavaVersion.VERSION_11)
}
kotlinOptions {
jvmTarget = "11"
}
![](https://img.haomeiwen.com/i2815884/fd43d8235fe7fceb.png)
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':base_extend:kaptGenerateStubsReleaseKotlin'.
> 'compileReleaseJavaWithJavac' task (current target is 1.8) and 'kaptGenerateStubsReleaseKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':base:kaptGenerateStubsReleaseKotlin'.
> 'compileReleaseJavaWithJavac' task (current target is 11) and 'kaptGenerateStubsReleaseKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KaptGenerateStubs).configureEach{
kotlinOptions{jvmTarget = "1.8"}
}
![](https://img.haomeiwen.com/i2815884/2798d9d32635efea.png)
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KaptGenerateStubs>().configureEach {
kotlinOptions {
jvmTarget = "1.8"
}
}
全局
![](https://img.haomeiwen.com/i2815884/ee32b28bcd70f26f.png)
allprojects {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KaptGenerateStubs>().configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
}
https://kotlinlang.org/docs/gradle-configure-project.html?utm_campaign=gradle-jvm-toolchain&utm_medium=kgp&utm_source=warnings#other-details
https://www.null123.com/question/detail-2720063.html
https://www.saoniuhuo.com/question/detail-2492575.html
网友评论