Android Room 报 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.
一、使用 annotationProcessor
如果用的 annotationProcessor "androidx.room:room-compiler:xxx"
,在使用Room Module的build.gradle
文件添加:
android {
...
defaultConfig {
...
javaCompileOptions {
annotationProcessorOptions {
arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
}
}
二、使用 kapt
如果用的 kapt "androidx.room:room-compiler:xxx"
,在使用Room Module的build.gradle
文件添加:
android {
...
defaultConfig {
...
kapt {
arguments