我已将 kotlin 插件更新到 1.5.20 并发生了此问题。如果我返回 1.5.10 一切正常。
Schema export directory is not provided to the annotation processor so we cannot import the schema. To generate auto migrations, you must provide `room.schemaLocation` annotation processor argument AND set exportSchema to true.
public abstract class BatteryInfoDatabase extends androidx.room.RoomDatabase {
Run Code Online (Sandbox Code Playgroud)
我正在使用最新版本的 Room 持久性库 alpha 3,因为它提供自动迁移
def room_version = "2.4.0-alpha03"
implementation("androidx.room:room-ktx:$room_version")
kapt("androidx.room:room-compiler:$room_version")
Run Code Online (Sandbox Code Playgroud)
javaCompileOptions {
annotationProcessorOptions {
arguments += [
"room.schemaLocation":"$projectDir/schemas".toString()]
}
}
Run Code Online (Sandbox Code Playgroud)