如何在领域浏览器中查看我的Realm文件?

如何在领域浏览器中查看我的Realm文件?

问题描述:

我刚刚发现了Realm,并且想要更详细地探索它,所以我决定创建示例应用程序并搞乱它。到目前为止一切顺利。

I've just discovered Realm and wanted to explore it in more detail so I decided to create sample application and having a mess around with it. So far so good.

然而,我还没有解决的一件事是如何在Realm Browser中查看我的数据库。怎么办呢?

However, one thing I haven't been able to work out just yet is how to view my database in the Realm Browser. How can this be done?

目前Realm Browser不支持直接在设备*问数据库,所以你需要从模拟器/手机复制数据库以查看它。这可以通过使用ADB来完成:

Currently the Realm Browser doesn't support accessing databases directly on the device, so you need to copy the database from the emulator/phone to view it. That can be done by using ADB:

adb pull / data / data /< packagename> / files /。

该命令将获取使用 Realm.getInstance(new RealmConfiguration.Builder()。build())$ c创建的所有Realm文件$ c>。默认数据库名为 default.realm

That command will pull all Realm files created using Realm.getInstance(new RealmConfiguration.Builder().build()) . The default database is called default.realm.

请注意,这只适用于模拟器或设备根深蒂固。

Note that this will only work on a emulator or if the device is rooted.