google / ksp

Kotlin Symbol Processing API
https://github.com/google/ksp
Apache License 2.0
2.85k stars 268 forks source link

Unable to load class 'com.google.devtools.ksp.gradle.KspTaskJvm' #1519

Open SuyashFirstdata opened 1 year ago

SuyashFirstdata commented 1 year ago

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

TWiStErRob commented 1 year ago

I ran into this as well, my problem was that:

Solution was:

Yours might be a different beast, but the error message was the same for me. Hope the above helps someone.


@SuyashFirstdata Would you mind editing your OP to drop a pair of ``` around your exception, so it scrolls and easier to read?

varundroid commented 1 month ago

I ran into this as well, my problem was that:

  • I was applying id("com.google.devtools.ksp") version "1.9.10-1.0.13" in just one module.
  • Hilt was in gradle/plugins/build.gradle.kts as an included build classpath with implementation(libs.hiltGradlePlugin).

Solution was:

  • Add ksp to as an implementation dependency next to hilt
  • Removed the version from the module.

Yours might be a different beast, but the error message was the same for me. Hope the above helps someone.

@SuyashFirstdata Would you mind editing your OP to drop a pair of ``` around your exception, so it scrolls and easier to read?

@TWiStErRob Thanks for sharing the solution. Would you mind sharing the exact line you added to your project? I am having the same issue but have no luck so far resolving this. I am using Kotlin 1.9.20, KSP 1.9.20-1.0.14 and Hilt 2.48.

sarahmarie23 commented 1 month ago

@varundroid I was having this issue too and I was missing the plugin id("com.google.devtools.ksp") version "2.0.10-1.0.24" apply false from the project level Gradle file. It needs to be in both the project level and module level files. For the module level Gradle file the plugin I used was id("com.google.devtools.ksp").