Unable to load class 'org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinCompilationData'
Asked Answered
W

2

7

I cloned this old Android project that uses kapt, after I updated all the dependencies and I made sure everything is working fine, I decided to migrate from kapt to ksp I followed the instructions provided in the documentation
I keep getting this error:

Unable to load class 'org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinCompilationData'
org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinCompilationData

Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.

Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

I have followed all the provided instructions from restarting, redownloading, cleaning the project, deleting all the Gradle caches, but I keep getting this error, when I tried to migrate back to kapt the project worked just fine!

Waine answered 5/6 at 23:43 Comment(1)
You need to share your build scripts to get proper answers.Eldoree
T
15

I had similar issue, the problem was caused by combine:

kotlin 1.8.0 with com.google.devtools.ksp' version '1.8.10-1.0.9'

I sove it by update: kotlin 1.9.0 with com.google.devtools.ksp' version '1.9.0-1.0.13

Reference

https://youtrack.jetbrains.com/issue/KT-58186/Unable-to-load-class-org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinCompilationData

Troublesome answered 5/8 at 15:22 Comment(0)
V
1

I solved it by updating to com.google.devtools.ksp version 2.0.21-1.0.25 and it worked fine

Vanburen answered 27/10 at 16:48 Comment(1)
Same for me, all other versions didn't work, but ksp "2.0.21-1.0.25" + kotlin "2.0.21" worked fine!Looseleaf

© 2022 - 2024 — McMap. All rights reserved.