Browse SQLite database from Android Studio [closed]
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.
You can find more info about Stetho here:
Install Sqlite
Open DDMS : Tools > Android > Android Device Monitor
Click on your device on the left.
You should see your application:
Go to File Explorer
(one of the tabs on the right), go to /data/data/databases
and select your application package
Ex: check image
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:
A window will open asking you where you want to save your database file.Save it anywhere you want on your PC.
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.
I'm using TKlerx/android-sqlite-browser-for-eclipse for instant browsing inside Android Device Monitor
. I found it the fastest and most practical way.
Just download the jar from the releases page and place it in the [android-sdk-folder]/tools/lib/monitor-x86_64/plugins
.
Afterwards, just browse any database file inside the File Explorer
and click the blue-ish icon shown in the picture:
Enjoy !