27

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

VSK Bhargav
  • 273
  • 1
  • 3
  • 9

6 Answers6

35
  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.

Gustavo Barbosa
  • 1,340
  • 1
  • 17
  • 27
sudharsan
  • 474
  • 4
  • 4
  • @RohitBandil not sure. I've only tried through Genymotion's emulator. – Gustavo Barbosa Nov 23 '16 at 21:01
  • 1
    I followed the process on Android Studio default emulator and it works fine. Instead of FireFox I used [DB browser for SQLite](http://sqlitebrowser.org/). It's awesome! – Hasan Abdullah Jan 20 '17 at 05:58
  • 8
    In `data -> data -> your project name`, the first `data` directory doesn't open. What should I do ? (my device is Amazon Fire Tablet) – McLan Apr 27 '17 at 10:48
  • 1
    I run my app in an emulator with API 23 and the "File Explorer" in the Monitor shows the content of "data" directory ... – Marcos Sep 19 '17 at 07:09
9

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!

Abdellah Benhammou
  • 402
  • 1
  • 8
  • 22
7

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

Pravin Divraniya
  • 4,223
  • 2
  • 32
  • 49
Tushar Saha
  • 1,978
  • 24
  • 29
  • that seems like a fantastic tip - but how to run "adb" on a Mac, where is it?! – Fattie Jan 06 '17 at 02:15
  • Getting below error while applying your solution. `D:\Softwares\Installed\Android-SDK\platform-tools>adb pull /data/data/com.android.com.myapp/databases.MyApp.db adb: error: remote object '/data/data/com.android.com.myapp/databases.MyApp.db' does not exist` **MyApp** is my database name. I tried, where my project resides. Got below error. `D:\Projects\Android\Android Studio Workspace\MyApp>adb pull /data/data/com.android.com.myapp/databases.MyApp.db 'adb' is not recognized as an internal or external command, operable program or batch file. ` I'm working with real device. – Maulik Dodia May 01 '17 at 09:27
  • Do I need to root the device?@TusharSaha – Maulik Dodia May 02 '17 at 11:38
  • you may root or simply write a function which would copy db from db folder to sdcard/internal storage and then transfer it to pc – Tushar Saha May 03 '17 at 08:35
5

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

enter image description here

To View sqlite database:

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

Stephen
  • 9,899
  • 16
  • 90
  • 137
1

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

enter image description here enter image description here

Rahat Zaman
  • 1,322
  • 14
  • 32
0

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.

Eric Farraro
  • 865
  • 2
  • 7
  • 14