How to see the data stored in sqlite in android st

2019-03-17 12:06发布

问题:

As i am having AMD processor in my laptop i am using GENYMOTION as an emulator. I have stored the data in sqlite as it is a plugin in android studio. But if i want to see the data using DDMS the file explorer showing nothing. How can i see the data stored in sqlite database using androidstudio and using GENYMOTION. Thanks in advance

回答1:

  1. Go to Tools -> DDMS or click the Device Monitor icon next to SDK Manager in Tool bar.

  2. Device Monitor window will open. In File Explorer tab, click data -> data -> your project name. After that your databases file will open. Click pull a file from device icon. Save the file using .db extension.

  3. Open FireFox, Press Alt , Tools -> SQLiteManager.

  4. Follow Database -> connect to Database -> browse your database file and click ok. Your SQLite file will opened now.



回答2:

One of the things that hasn't changed on Android Studio is the Android Device Monitor. so this applies to AS and Eclipse.

1) Download the jar SQLite browser plugin from https://github.com/TKlerx/android-sqlite-browser-for-eclipse/releases

2) Put the jar in: [YourAndroidSdkDirectory]/tools/lib/monitor-x86_64/plugins/AndroidSQLiteBrowser_1.0.1.jar

3) Restart the Android Device Monitor.

4) Select the .db file inside the device(rooted) or the emulator and click on the SQLite browser on the top right corner next to the (+) new folder button.

5) Enjoy!



回答3:

pull database using adb commands

adb pull /data/data/com.android.packagename/databases/datebase.db

the db will be pulled to current location where terminal is pointing to

then open db using sqliteman



回答4:

Update Android studio to the latest version 3.0 and we have access to Device File Explorer in :

View -> Tools Window -> Device File Explorer

Official Documenation

To View sqlite database:

install Mozilla sqlite plugin adons or any other sqlite manager plugin to view the sqlite database.



回答5:

Depending on the complexity of the data, you can also use an sqlite browser on the device itself. There are various free sqlite browsers for Android (SQLite Manager comes to mind) that will allow you to browse sqlite data on a rooted devices. Since the genymotion device images are rooted, it's easy to install one of these applications and view the data that way. Again, this works best if the data is simple -- it's a bit cumbersome for larger datasets.



回答6:

You can use IDEscout. It helps inspect any applications database realtime. You can also edit the database as your need.

All you need is download the IDEscout plugin for android studio. Then for connecting to your project:

  1. Add the dependency to your project level gradle.buid

    allprojects {
       repositories {
          jcenter()
          maven {
              url 'http://www.idescout.com/maven/repo/'
          }
       }
    }
    
  2. Add com.idescout.sql:sqlscout-server:2.0 as a dependency to your project's app module:

    compile 'com.idescout.sql:sqlscout-server:2.0'
    
  3. In the onCreate method of your main Activity invoke the method com.idescout.sql.SqlScoutServer#create as follows:

    @Override
    public void onCreate(Bundle savedInstanceState) {
        SqlScoutServer.create(this, getPackageName());
    

Here are some using views for live data visualization and editing