Mickey Williamson
Database inspection window in Chrome DevTools from Android emulator

Set Up Stetho to View Your Room Database

Building an app that uses a backend database for persistent data storage without access to the database can be like playing darts in the dark. While building out the app’s functionality, how do you know whether data is getting stored in the database correctly or even at all? There are several methods for viewing your Room database from an Android device or emulator. In this blog post, I’m going to talk about how to set up Facebook’s Stetho to view your database.

  1. Add the Stetho dependency to your app’s build.gradle file:
    implementation 'com.facebook.stetho:stetho:1.5.1'

  2. Extend the Application class in your app and initialize Stetho:
    public class MyApplication extends Application {
    public void onCreate() {
    super.onCreate();
    Stetho.initializeWithDefaults(this);
    }
    }

  3. Make sure your MyApplication class is referenced in the main application tag in your manifest.xml:
    <application
    android:name=".MyApplication"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

  4. Run your app from Android Studio

  5. Visit chrome://inspect/#devices in your Chrome browser. Your app will be listed. Click the inspect link under its name and a new DevTools window will be launched.

  6. To view the database, expand “Web SQL” in the menu on the left and you’ll see your database listed. Click to expand to view the tables.


No need to throw darts in the dark and wonder where they landed anymore!

Leave a Comment