I would like to know is there any SQLite plugin for Android Studio which will allow user to browse the created database?
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 !
There is no such feature or plugin for Android Studio at least now.
Check out stetho - one of features of this library is to provide a bridge to view your device database contents directly from Chrome Developer Tools in desktop Chrome browser.
You should go to Tools>Android>Android device monitor it would then launch the android device monitor Then you should navigate to the file explorer in the Android device monitor and then navigate to the database where you have saved it in the device and then use the option pull a file from a device. and save the database file where ever you want and if you want to open and view the data in it use the following link
As far as I know, currently there is no plugin available to browse SQLite database directly from the Android Studio. You can extract your database file from "File Explorer".
You can find "File Explorer" from here.
Tools > Android > Android Device Monitor
You can browse your database using Firefox Extension.
Visit Android Studio Plugins for android-studio related plugins.
来源:https://stackoverflow.com/questions/29138442/browse-sqlite-database-from-android-studio