我们处于开发阶段并且db架构更改经常发生。由于我们没有生活,所以不需要迁移。我为此配置的领域如下:如果需要迁移,则领域不会自动删除数据库
RealmConfiguration config = new RealmConfiguration.Builder(context)
.name("jt.realm")
.schemaVersion(1)
.deleteRealmIfMigrationNeeded() // todo remove for production
.build();
Realm.setDefaultConfiguration(config);
然而,当模式改变时,会抛出异常:RealmMigration must be provided
我从文档的理解是,该领域应自动删除该数据库自deleteRealmIfMigrationNeeded( )存在于配置中,但这似乎没有发生。为什么会发生?
Android Studio中依赖
编译 'io.realm:境界 - 安卓:0.86.1'
我们不能产生这个问题。你有多个Realm,有可能是在其他地方抛出异常? – beeender
@beeender我只是在启动时在1个地方创建默认配置 – RunLoop
你能在adb日志中看到类似'无法删除文件'的东西吗? – beeender