Search code examples
androidsqliteandroid-roomandroid-debug

Debugging a Database and SQLite file not consistent


I'm debugging an issue with an Android application that seems to stem from missing data in its SQLite database. When I open the database using Android Debug Database, the data is shown. However, when I save the SQLite file to my computer using Android Studio's Device File Explorer and then open it up with a SQLite client, the data is missing.

Using Room to manage the SQLite db, and used both TablePlus and DB Browser for SQLite to view the db on my computer.


Solution

  • Room uses write-ahead logging (WAL). Much of the time, this means that the SQLite database consists of three files:

    • Whatever you named the base file
    • One with .wal
    • One with .shm

    You need to copy all three if you wish to use the database elsewhere (e.g., desktop SQLite browser, backup/restore).