【发布时间】:2018-11-20 05:54:27
【问题描述】:
为什么我在 Android 中添加 .fallbackToDestructiveMigration() 后仍收到错误 Room cannot verify the data integrity. Looks like you've changed schema but forgot to update the version number. You can simply fix this by increasing the version number.?
private fun buildDatabase(context: Context): AppDatabase {
val appDatabase = Room.databaseBuilder(context.applicationContext,
AppDatabase::class.java,
DATABASE_NAME
)
if (BuildConfig.DEBUG) {
appDatabase.fallbackToDestructiveMigration()
}
return appDatabase.build()
}
【问题讨论】:
标签: android kotlin android-room