lundi 13 juillet 2015

Debugging SQLite Database from Android App

I am writing an Android Application with a SQLite Database in the background. This Database gets created by the App, and is stored on the default directory on the device:

shell@android: ls /data/data/com.package.example/databases # 
MyDb.db
MyDb.db-journal

During development I want to test, if the rows are inserted / updated correctly, so I need to take a look on the database. There is a pretty nice tool called SQLite Database Browser (Available for Win, Mac and Linux).

With this tool I can open the database, browse, insert and update the rows and so on... The problem is, that I first need to copy the database from the device to my local machine:

# On Android Shell
# (Cannot pull directly from /data/-directory)
cp /data/data/com.package.example/databases/MyDb.db /sdcard/


# On developing machine
adb pull /sdcard/MyDb.db

Than I have the database on my machine and I can finally open it.

My Question is: Is there a better / quicker way of doing it? Can I somehow directly access the database on the device?

Aucun commentaire:

Enregistrer un commentaire