View SQLite database on device in Android Studio

前端 未结 4 1539
情歌与酒
情歌与酒 2020-12-14 02:10

I am using the latest version of Android Studio. When I run my app on the emulator, I am able to view my database by going through:

tools -> Android Device

4条回答
  •  清歌不尽
    2020-12-14 03:13

    Below is the simplest solution for viewing sqlite database in Android.

    https://github.com/facebook/stetho

    Steps to view SQLite DB

    1) Add gradle dependency

    compile 'com.facebook.stetho:stetho:1.5.0' 
    implementation 'com.facebook.stetho:stetho:1.5.0' - for kotlin
    

    2) In Application class

    public class MyApplication extends Application {
      public void onCreate() {
       super.onCreate();
       Stetho.initializeWithDefaults(this);
      }
    } 
    

    3) Go to google chrome and type 'chrome://inspect/#devices' to see connected devices and can access SQlite DB.

提交回复
热议问题