I used the following to use KSP in combination with Room:
plugins {
id 'com.google.devtools.ksp' version "$kotlin_version-1.0.0"
dependencies {
ksp "androidx.room:room-compiler:$room_version"
And this actually works. However, when I try to run it, I'll get this warning
[ksp] MyDatabase.kt:11: Schema export directory is not provided to the annotation processor so we cannot export the schema. You can either provide
room.schemaLocation
annotation processor argument OR set exportSchema to false.
In order to do that: how do I provide annotation processor arguments when using KSP?
Add the following to your build.gradle:
defaultConfig {
// ...
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
}
}