【发布时间】:2019-03-07 14:37:38
【问题描述】:
我正在尝试构建一个正在开发的 Room 数据库。但是在做了一些更改之后,Room 一直抛出这个错误:
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.
问题是:我什至没有写入数据库!因此,应该没有任何问题,因为没有数据可以检查完整性。 在搜索了有关如何从我的测试手机中完全删除 Room 架构的答案后,我尝试了以下方法:
- 增加版本号(Room 没有要求迁移)
- 更改数据库名称
禁用 AndroidManifest.xml 中的 allowBackup、fullBackupOnly 和 fullBackupContent
清除应用程序数据和缓存
- 卸载应用程序
- 删除 Google 云端硬盘上的备份
但 Room 坚持无法验证数据的完整性。我该怎么办?
编辑:看起来我解决了这个问题。我不得不将我的数据库一直升级到版本 6!我不知道为什么,但那发生了。如果您正在创建 Room 数据库,请确保您的架构正确,否则...
【问题讨论】:
标签: android sqlite android-room