Closed ChaabouniMed closed 3 months ago
Yes it changed when we updated the JDK that we're building with because JDK22 deprecated support for targeting Java 8, I forgot to mention it in the release notes.
This should work
android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
}
Which Android Gradle Plugin version are you using?
I'm using: agp = "8.2.0"
Could you try adding this to your project? kts
tasks.withType<JavaCompile>().configureEach {
this.sourceCompatibility = "11"
this.targetCompatibility = "11"
}
groovy
tasks.withType(JavaCompile).configureEach {
sourceCompatibility = "11"
targetCompatibility = "11"
}
I have aaded this to all my project modules and the error is still there.
NB: kotlinOptions is depracated, and this warning is displayed : 'kotlinOptions(KotlinJvmOptionsDeprecated / = KotlinJvmOptions /.() -> Unit): Unit' is deprecated. Please migrate to the compilerOptions DSL. More details are here: https://kotl.in/u1r8ln
The warning is displayed in this scope of my kts :
tasks.withType
and it wasn't when my jvmTarget was at 1.8
It's hard to say but if that also doesn't work it seems like something else is setting it to 1.8
again. What Kotlin does is that it compares the target on the java task with the jvmTarget on the Kotlin task. From the error in your initial post jvmTarget
gets applied but something sets targetCompatibility
to 1.8.
The kotlinOptions
block was deprecated in Kotlin 2.0 in favor of compilerOptions
, but that has nothing to do with the target.
It's ok I didn't add the sourceCompatibility and the targetCompatibility in a specefic component in my project. Thanks
I migrated from version 1.2.0 to 1.2.2 and encountered the following error:
"Cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify the proper '-jvm-target' option."
Did the jvmTarget change in this version?
I have changed jvmTarget in my build.gradle file like this :
compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } kotlinOptions { jvmTarget = "11" }
but I got this error now : "Execution failed for task ':arc-si-types:compileDebugKotlinAndroid'.