How do I view my Realm file in the Realm Browser?

Now you can view Realm DB on Chrome browser using Stetho, developed by Facebook. By default, Stetho allows to view Sqlite, network, sharedpreferences but with additional plugin here allows to view Realm as well.

After configuring your Application class with above libraries, while app is running and connected, open Chrome browser and navigate chrome://inspect to see


enter image description here

Then Resources->Web Sql->default.realm


enter image description here


You can also pull your file from any NON-rooted device using the ADB shell and run-as command.

You can use these commands to pull from your app's private storage a database named your_database_file_name located in the files folder:

adb shell "run-as package.name chmod 666 /data/data/package.name/files/your_database_file_name"

// For devices running an android version lower than Android 5.0 (Lollipop)
adb pull /data/data/package.name/files/your_database_file_name

// For devices running an Android version equal or grater
// than Android 5.0 (Lollipop)
adb exec-out run-as package.name cat files/your_database_file_name > your_database_file_name
adb shell "run-as package.name chmod 600 /data/data/package.name/files/your_database_file_name"

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/ .

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.