0

This is my first time writing an Android app that utilizes a database.

I have created a test database in the assets folder. I then have the app copy the database to the database folder: /data/data/myapplication1/databases/myDB.db

I realize now that the assets folders are read only, but how can I sync my database so I can verify, using SQLite browser, the changes I have made?

Should I just move my test DB from assets to a different location? Is there something better?

Or is there a way I can view the DB in the databases folder? (which I believe is protected so it is not visible to other programs)

1 Answer 1

2

to view the database from the databases folder:

  1. with adb on either a rooted device or an emulator, just adb pull /data/data/myapplication/databases/mydb.db.
  2. with adb on a non-rooted/non-emulator, you can try adb shell "run-as [package.name.myapplication] cp /data/data/myapplication/databases/mydb.db /sdcard/mydb.db", and then adb pull /sdcard/mydb.db.
  3. if you integrate stetho in your app, you can easily inspect sqlite databases from chrome.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.