I am using Android Database Component Room
I’ve configured everything, but when I compile, Android Studio gives me this warning:
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.
As I understand it is the location where DB file will be located
How can it affect my app? What is the best practice here? Should I use the default location (false
value)?
In the build.gradle
file for your app module, add this to the defaultConfig
section (under the android
section). This will write out the schema to a schemas
subfolder of your project folder.
javaCompileOptions {
annotationProcessorOptions {
arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
Like this:
// ...
android {
// ... (compileSdkVersion, buildToolsVersion, etc)
defaultConfig {
// ... (applicationId, miSdkVersion, etc)
javaCompileOptions {
annotationProcessorOptions {
arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
}
// ... (buildTypes, compileOptions, etc)
}
// ...