Summary
The project uses kotlin-kapt to process Room's annotation processor (androidx.room:room-compiler). KSP (Kotlin Symbol Processing) is the modern replacement for KAPT and is now the recommended processor for Room.
Motivation
- KSP is ~2x faster than KAPT because it runs natively in Kotlin, avoiding the Java stub generation step.
kotlin-kapt is in maintenance mode; JetBrains recommends moving to KSP.
- Room has first-class KSP support since Room 2.5.0 (current version is 2.6.1).
- The
app/build.gradle.kts already uses kotlin-kapt and has kapt { correctErrorTypes = true } which can be removed.
Proposed Changes
- In
app/build.gradle.kts (and any module using Room), replace:
with:
id("com.google.devtools.ksp")
- In
build.gradle.kts (root), add the KSP plugin to the buildscript classpath.
- In
DependencyHandlerExtensions.kt, change add("kapt", Dependencies.roomCompiler) to add("ksp", Dependencies.roomCompiler).
- Update
Dependencies.kt: room-compiler artifact stays the same; only the configuration changes.
- Remove the
kapt { correctErrorTypes = true } block from app/build.gradle.kts.
- Add
ksp version constant to Versions.kt (match the Kotlin version).
References
Summary
The project uses
kotlin-kaptto process Room's annotation processor (androidx.room:room-compiler). KSP (Kotlin Symbol Processing) is the modern replacement for KAPT and is now the recommended processor for Room.Motivation
kotlin-kaptis in maintenance mode; JetBrains recommends moving to KSP.app/build.gradle.ktsalready useskotlin-kaptand haskapt { correctErrorTypes = true }which can be removed.Proposed Changes
app/build.gradle.kts(and any module using Room), replace:id("kotlin-kapt")id("com.google.devtools.ksp")build.gradle.kts(root), add the KSP plugin to the buildscript classpath.DependencyHandlerExtensions.kt, changeadd("kapt", Dependencies.roomCompiler)toadd("ksp", Dependencies.roomCompiler).Dependencies.kt:room-compilerartifact stays the same; only the configuration changes.kapt { correctErrorTypes = true }block fromapp/build.gradle.kts.kspversion constant toVersions.kt(match the Kotlin version).References