Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Provide annotation processor argument when using Kotlin Symbol Processing (KSP)

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?

like image 531
Cristan Avatar asked Sep 06 '25 11:09

Cristan


1 Answers

Add the following to your build.gradle:

defaultConfig {
    // ...
    ksp {
        arg("room.schemaLocation", "$projectDir/schemas")
    }
}
like image 170
Cristan Avatar answered Sep 08 '25 01:09

Cristan