compileDebugJavaWithJavac' task (current target is 18) and 'kaptGenerateStubsDebugKotlin' task (current target is 19)

299 views Asked by At
compileDebugJavaWithJavac' task (current target is 18) and 'kaptGenerateStubsDebugKotlin' task (current target is 19) jvm target compatibility should be set to the same Java version.

Doesn't Java have backward compatibility? because of a library I had to use java 18 in a project but I updated my jdk to 19 while ago. I shouldn't get this error, should I?

1

There are 1 answers

0
KP_ On

In case, if you get the error again, You can add the below lines inside build.gradle.kts(App level)

 android {
        ----
 compileOptions {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
    jvmTarget = "1.8"
}
 kotlin {
    jvmToolchain(8)
  }
 }