Browse SQLite database from Android Studio [closed]

∥☆過路亽.° 提交于 2019-11-26 15:32:50

问题


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


回答1:


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:

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

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




回答2:


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.




回答3:


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 !




回答4:


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.




回答5:


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

SqLiteBrowser




回答6:


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




回答7:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!