Log all SQL statements in an Android app

If you are using SQLite as your data store in an Android app, and you want to try and trace through the SQL statements that are occurring, it can be painful, especially if you are working with a large code base that you may not be 100% familiar with.

Luckily, there is a super easy way to do this with no code changes. Once you have opened the simulator, go to the terminal and execute these commands:

adb shell setprop log.tag.SQLiteLog V
adb shell setprop log.tag.SQLiteStatements V
adb shell stop
adb shell start

Then, in the Android monitor, you will probably want to filter by SQLiteStatements to see the relevant entries.

Leave a Reply