ksp: KSP conflict with KGP, which causes failures with Android Studio
Incompatibility between KSP and KGP after attempting several different version combinations of the aforementioned plugins. More information can be referenced in the following issue https://issuetracker.google.com/issues/270166324
Caused by: java.lang.NoClassDefFoundError: org/jetbrains/kotlin/gradle/plugin/mpp/pm20/KotlinCompilationData
at com.google.devtools.ksp.gradle.KspGradleSubplugin.applyToCompilation(KspSubplugin.kt:416)
at org.jetbrains.kotlin.gradle.plugin.SubpluginEnvironment.addSubpluginOptions(SubpluginEnvironment.kt:49)
at org.jetbrains.kotlin.gradle.plugin.AndroidProjectHandler$configureTarget$2$1.invoke(AndroidProjectHandler.kt:106)
at org.jetbrains.kotlin.gradle.plugin.AndroidProjectHandler$configureTarget$2$1.invoke(AndroidProjectHandler.kt:101)
at org.jetbrains.kotlin.gradle.utils.ForEachAndroidVariantKt$sam$org_gradle_api_Action$0.execute(forEachAndroidVariant.kt)
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 15
In my case I got this error, in a project where I was using kotlin ‘1.8.21’ with ksp ‘1.8.10-1.0.9’. Android Studio just showed above error message, but running gradle from the command line, I got the following message:
ksp-1.8.10-1.0.9 is too old for kotlin-1.8.21. Please upgrade ksp or downgrade kotlin-gradle-plugin to 1.8.10.
Upgrading ksp to “1.8.21-1.0.11” solved the problem.
It worked, thank you very much
Thank you for the solution. In my case, the KSP plugin version 1.8.21-1.0.11 was too old and incompatible with Kotlin version 1.9.0. I resolved the error by updating to KSP version 1.9.0-1.0.13, which is compatible with Kotlin 1.9.0.
Thanks for your solution. You may need to update the Google developers documentation with the new version as the old one failed with most of us. Thanks!
Oops, my mistake, I meant checking Gradle version used by AGP.