How to Debug Android Database File

Yuchen Z.
1 min readFeb 3, 2017

After executing some sql commands, how do I know whether the data is modified in the database at all? A quick and easy way is to use: Android Debug Bridge (adb) .

On mac, adb is by default located under the following directory.

/Users/yuchen/Library/Android/sdk/platform-tools

Recommend adding this to PATH so that it is easier for further use either globally /etc/paths or locally for the current local user ~/.bash_profile.

Here are some useful commands:

Get a list of all devices:

<pre>adb devices</pre>

Enter the device shell

<pre>adb -s emulator-5554 shell</pre>

Show the database files:

<pre>ls /data/com.example.yuchen.example/databases/</pre>
<pre>database.db database.db-journal</pre>

Open with sqlight3:

<pre>sqlite3 /data/data/com.example.yuchen.example/databases/database.db</pre>

Happy debugging!

--

--