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.
- Enter
adb shell
- Navigate to the folder where your apps databases are:
cd /data/data/<your app package name>/databases/
- Type
ls
to see which database files are present. - Open a database file with the sqlite3 tool:
sqlite3 database-name.db
- You can now browse around the database, using the different supported commands.
To see all commands, type.help
To list all tables in this database, type.tables
To list all rows in a table, typeSELECT * FROM tablename;
- When you are done browsing the database, type
.exit
to 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.