[Jetpack Compose / Kotlin] How to solve Unable to load class ‘org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinCompilationData’.

Jetpack Compose

Cause of Problem

This error is caused by missing version defining.

When I was getting the title's error I've defined com.google.devtools.ksp module as the follow that file is located as project root gradle file.
(project)/build.gradle.kt

plugins {
    id("com.google.devtools.ksp") version "1.8.10-1.0.9" apply false
    alias(libs.plugins.androidApplication) apply false
    alias(libs.plugins.jetbrainsKotlinAndroid) apply false
}

The key of that is caused this error is the part of 1.8.10-1.0.9, which didn't match for my environment. So I changed the follow.

(project)/build.gradle.kt

plugins {
    id("com.google.devtools.ksp") version "1.8.22-1.0.11" apply false
    alias(libs.plugins.androidApplication) apply false
    alias(libs.plugins.jetbrainsKotlinAndroid) apply false
}

And my module level build.gradle is the follow which is shown for only part of plugins to be consice.

plugins {
    alias(libs.plugins.androidApplication)
    alias(libs.plugins.jetbrainsKotlinAndroid)
    id("com.google.devtools.ksp")
}

To use Room module, you have to get dependencies of ksp. Hope this article will get solved your problem.

コメント

タイトルとURLをコピーしました