How to extract the sqlite database from the Android device using ADB?


I followed the step by step instructions given in the answer of How do I view the SQLite database on an Android device?

1) Connect your device and launch the application in debug mode.

2) Copy the database file from your application folder to your sd card. You may want to use adb -d shell "run-as com.resmed.mon ls /data/data/com.resmed.mon/databases/" to see what the database filename is.

3) adb -d shell "run-as cat /data/data/ > /sdcard/filename.sqlite"

(in my case "/data/data/")

4) Pull the database files to your machine:

5) adb pull /sdcard/filename.sqlite .

6) Install Firefox SQLLite Manager:

7) Open Firefox SQLLite Manager (Tools->SQLite Manager) and open your database file from step 3 above."

But in my case, the database extracted is always empty. When i open the file on SQL Lite Manager, i can't find my tables and my data. I don't understand why. I can see the data on my device screen using my app in debug mode. Is there an other folder where my database could be stored ? My phone is not rooted.

Thanks for your help.

PS : I wanted to comment on the previous answer, but my reputation is too low to interact with the answer.

I've published a simple shell script for dumping databases:

It performs two distinct methods described here:

  1. First, it tries to make the file accessible for other users, and attempting to pull it from the device.
  2. If that fails, it streams the contents of the file over the terminal to the local machine. It performs an additional trick to remove \r characters that some devices output to the shell.

From here you can use a variety of CLI or GUI SQLite applications, such as sqlite3 or sqlitebrowser, to browse the contents of the database.