gsala
02/14/2023, 10:16 AM> ‘compileDebugJavaWithJavac’ task (current target is 11) and ‘kaptGenerateStubsDebugKotlin’ task (current target is 17) jvm target compatibility should be set to the same Java version.I’m running Gradle on JVM version 17, and I have set the `sourceCompatibility`/`targetCompatibility`/`jvmTarget` options in the my
build.gradle
files to JavaVersion.VERSION_11
.
The error disappears if I align the Gradle JVM and target versions to be either 11 or 17, but I didn’t think these versions needed to be aligned.
Does anyone have any input on what versions we should be using?Charlie Tapping
02/14/2023, 11:46 AMgsala
02/14/2023, 12:48 PMCharlie Tapping
02/14/2023, 1:37 PMChrimaeon
02/14/2023, 4:13 PMtoolchain
correctly.
I.e. read over here https://blog.jetbrains.com/kotlin/2021/11/gradle-jvm-toolchain-support-in-the-kotlin-plugin/itnoles
02/17/2023, 1:58 PMBilly Newman
05/05/2023, 2:43 PMcompileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlin {
jvmToolchain(17)
}
kotlinOptions {
jvmTarget = "17"
}
Still no luck, any ideas?gsala
05/05/2023, 3:31 PMitnoles
05/05/2023, 3:35 PMBilly Newman
05/05/2023, 4:07 PMitnoles
05/05/2023, 4:09 PMBilly Newman
05/05/2023, 4:10 PMtasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
kotlinOptions {
jvmTarget = "11"
}
}
Execution failed for task ':app:kaptGenerateStubsDebugKotlin'.
> 'compileDebugJavaWithJavac' task (current target is 1.8) and 'kaptGenerateStubsDebugKotlin' 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>
itnoles
05/06/2023, 7:19 PMtasks.withType<KaptGenerateStubsTask>().configureEach {
kotlinOptions.jvmTarget = "11"
}