Search code examples
androiddatabaserealm

How can I get my Realm Database in a file to open in Realm Studio?


I'm using Android Studio in macOS. My application has a Realm Database with a lot of tables. I'd like to get the database from my device and put it in a file (.realm) and open the file in Realm Studio.

Maybe using ADB I could get the database from my phone ?


Solution

  • You can find your realm file in the Device File Explorer tab at the bottom right of Android Studio. The location will be /data/data/com.<package-name>/files/default.realm assuming you haven't named your realm file. Simply right-click and "Save As" to a location on your PC and open in Realm Studio. You can't view the realm file on the actual device so you will have to download this realm file every time you want to inspect what's happening in realm. This also means that you need to download the realm file every time you make a change in realm that you want to inspect as you're not actually opening the realm file on the device.