This is an example of how to access the sqlite database of an Android app running on an emulator.
Make sure you have the android adb tool on your PATH.
Run this command in the terminal:
adb version If you have adb on your path, it should show something similar to this:
Android Debug Bridge version 1.0.31
If not, follow this guide: Adding the adb tool to the terminal for easy access.
Accessing the SQLITE database
- Open a new Terminal window.
- Navigate to the folder where your apps databases are:
cd /data/data/<your app package name>/databases/
lsto see which database files are present.
- Open a database file with the sqlite3 tool:
- You can now browse around the database, using the different supported commands.
To see all commands, type
To list all tables in this database, type
.tablesTo list all rows in a table, type
SELECT * FROM tablename;
- When you are done browsing the database, type
.exitto return from the sqlite3 tool.
There are a lot of options with the sqlite tool, so I suggest you visit the sqlite documentation for more sqlite commands and examples.