Search code examples
androidkotlingradlebuildkapt

Build Error: 'kspDebugKotlin' task (current target is 17)


Execution failed for task ':app:kspDebugKotlin'. Unable to build with ksp

'compileDebugJavaWithJavac' task (current target is 1.8) and 'kspDebugKotlin' task (current target is 17) JVM target compatibility should be set to the same Java version.

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
    jvmTarget = '1.8'
}

Solution

  • I don't know why it causing problem, but I added this in gradle(project) and it worked.

    allprojects {
        tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
            kotlinOptions {
                jvmTarget = "1.8"
            }
        }
    }