Debug android: connect to sqlite db on the phone

I am building an application with SQLite db in it. Some data is not erased, as it should be, I would like to run special requests in existing db for debugging.

Is there a way to connect to SQLite db on the phone (or emulator) in debug mode?

+6
source share
2 answers

Yes, you can connect to your device (or emulator) using this guide . Use adb to connect to the emulator:

$ adb -s emulator-5554 shell 

and then run the sqlite3 application with the database you need:

 # sqlite3 /data/data/com.example.google.rss.rssexample/databases/rssitems.db 

Then you can run any SQL query you want.

+5
source

You can use the sqlite3 command to open the database. If you have a root device (also works with the emulator), use su to become root and access private files. If not, just debug the application and use run-as to open the database. Sort of:

 run-as my.package sqlite3 /data/data/my.package/databases/my.db 
+3
source

Source: https://habr.com/ru/post/895406/


All Articles