Skip to content

kspDebugKotlin task fails because of JVM target mismatch on latest 1.0.9 version #1288

Description

@skaldebane

Hi! I just upgraded my project to Kotlin 1.8.0 and ksp v1.8.0-1.0.9, and now I'm getting this error when building the app:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:kspDebugKotlin'. <30 lines>
Caused by: org.gradle.api.GradleException: 'compileDebugJavaWithJavac' task (current target is 11) and 'kspDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain

	at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.validateKotlinAndJavaHasSameTargetCompatibility(Tasks.kt:797)
	at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin_common(Tasks.kt:722)
	at com.google.devtools.ksp.gradle.KspTaskJvm.callCompilerAsync$kotlin_gradle_plugin_common(KotlinFactories.kt:189)
	at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin_common(Tasks.kt:530)
	at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.executeImpl(Tasks.kt:450)
        <... many more lines>

I never set the JVM to 17 anywhere in the project (with the only exception being that the JDK on which the IDE/Gradle runs is using JDK 17), so this is a pretty weird error to face.

Hope you could assist me with this bug.

Android Studio version: 2022.3.1 Canary 2 (Giraffe).
Android Gradle Plugin version: 8.1.0-alpha02
Gradle version (in wrapper): 8.0-rc-1
Kotlin version: 1.8.0
JVM target (in build.gradle.kts): Java 11
Library using ksp: Room Persistence Library

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions