View contents of database file in Android Studio

Viewing databases from Android Studio:

Option 1:

  1. Download and install SQLiteBrowser.

  2. Copy the database from the device to your PC:

    • Android Studio versions < 3.0:

      • Open DDMS via Tools > Android > Android Device Monitor

      • Click on your device on the left.
        You should see your application:
        enter image description here

      • Go to File Explorer (one of the tabs on the right), go to /data/data/databases
        enter image description here

      • Select the database by just clicking on it.

      • Go to the top right corner of the Android Device Monitor window. Click on the ‘pull a file from the device‘ button:
        enter image description here

      • A window will open asking you where you want to save your database file. Save it anywhere you want on your PC.

    • Android Studio versions >= 3.0:

      • Open Device File Explorer via View > Tool Windows > Device File Explorer

      • Go to data > data > PACKAGE_NAME > database, where PACKAGE_NAME is the name of your package (it is com.Movie in the example above)

      • Right click on the database and select Save As.... Save it anywhere you want on your PC.

  3. Now, open the SQLiteBrowser you installed. Click on ‘open database‘, navigate to the location you saved the database file, and open. You can now view the contents of your database.


Option 2:

Go to this Github repository and follow the instructions in the readme to be able to view your database on your device. What you get is something like this:

enter image description here

That’s it. It goes without saying however that you should undo all these steps before publishing your app.

Leave a Comment