Kotlin KSP symbol processing produced no output / failed in CI
KSP processors are tied to a Kotlin version: the KSP Gradle plugin version encodes the Kotlin version it supports (for example 2.0.21-1.0.28). A mismatch, or a processor added with the wrong configuration, makes kspKotlin fail or emit no generated code, and dependent references become unresolved.
What this error means
A :app:kspKotlin (or :app:kspDebugKotlin) task fails with a KSP version message, or the build later fails with "Unresolved reference" for a class the processor should have generated.
> Task :app:kspDebugKotlin FAILED
ksp-2.0.0-1.0.21 is too old for kotlin-2.0.21. Please upgrade ksp or downgrade kotlin.Common causes
KSP plugin version does not match the Kotlin version
The KSP version prefix must match the Kotlin compiler version. A stale KSP plugin refuses to run against a newer Kotlin resolved in CI.
The processor is on the wrong configuration
A symbol processor added with implementation instead of ksp(...) never registers, so no code is generated.
How to fix it
Align the KSP version with Kotlin
- Match the KSP plugin version prefix to your Kotlin version.
- Add each processor via the
ksp(...)configuration. - Run a clean build so generated sources are produced.
plugins {
kotlin("jvm") version "2.0.21"
id("com.google.devtools.ksp") version "2.0.21-1.0.28"
}
dependencies {
ksp("io.moshi:moshi-kotlin-codegen:1.15.1")
}Verify the KSP task actually runs
Run the ksp task explicitly with info logging to confirm it registers and generates output.
./gradlew clean :app:kspDebugKotlin --infoHow to prevent it
- Bump the KSP plugin whenever you bump Kotlin, keeping the version prefix in sync.
- Declare symbol processors with the
kspconfiguration only. - Use a version catalog so Kotlin and KSP versions move together.