Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browse SQLite database from Android Studio [closed]

I would like to know is there any SQLite plugin for Android Studio which will allow user to browse the created database?

like image 970
Mohamad Arafat Avatar asked Mar 19 '15 06:03

Mohamad Arafat


People also ask

How do I open a DB file on Android?

To open the database inspector select View -> Tool Windows -> Database Inspector from the menu bar of Android Studio. Connect a device running on API level 26 or higher. Run the app. The database schemas appear and you can select the database you want to see.


1 Answers

UPDATE July 2020

With Android Studio 4.1 (Canary 6 and higher), you can inspect, query, and modify your app's databases using the new Database Inspector.

You can find the official doc here.


Currently there isn't an official plugin for DB Inspection in your apps.

  • You can use the DDMS : Tools > Android > Android Device Monitor as described in @Subhalaxmi's answer

  • There is a beta plugin provided by idescout that you can try here.

  • There is the Stetho tool (open source and free) provided by Facebook

I suggest you using the Stetho open-sourced tool provided by Facebook. It is simple to implement and very powerful.

Just add the dependencies in your build.gradle

dependencies {     // Stetho core     compile 'com.facebook.stetho:stetho:1.3.1'             //Optional network helper     compile 'com.facebook.stetho:stetho-okhttp:1.3.1'        } 

Then just initialize the tool in your Application class:

Stetho.initialize(Stetho.newInitializerBuilder(this)         .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))         .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))         .build()); 

Finally just open Chrome on your pc and navigare in chrome://inspect.

Here you can display the database in the app (with read/write capabilities), and you can run queries.

enter image description here

You can find more info about Stetho here:

  • http://gmariotti.blogspot.it/2015/07/a-first-glance-at-stetho-tool.html

  • http://facebook.github.io/stetho/

like image 71
Gabriele Mariotti Avatar answered Oct 08 '22 03:10

Gabriele Mariotti