Android: The right way to pull SQLite database

Let’s say you are developing an Android app and want to access its database file named “content” from the test device/emulator. To access this file, located in app’s database directory, on both rooted and unrooted device would be

This seems to work but is incorrect. An SQLite database can have write-ahead logging (-wal) file, a journal (-journal), and shared memory (-shm) file. Anytime, you copy just the .db file; you might get an old copy of the database, the right way to copy is to copy all the four files, so that, the SQLite on the laptop displays the combined result.

You can use adb-enhanced to do this correctly

Here is a generalized bash script if you don’t want to install a new tool

  • Category: all

Leave a Reply

Your email address will not be published. Required fields are marked *