I'm trying to upgrade my Android Gradle Plugin to 8.0 with the latest stable Flamingo release.
However, I get this issue after running the AGP upgrade assistant and trying to run the build.
Caused by: org.gradle.api.GradleException: '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.
I've updated these lines in the build.gradle files
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
However, I'm still getting this issue.
What does this issue mean and how can I fix it?
This code snippet syntax is deprecated :
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
use this instead :
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlin {
jvmToolchain(17)
}
Try this: Go to
File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
and change Gradle SDK to match your project java version - 17.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With