I've just got my first SQLite database up and running but to reproduce it I wanted a quick way to clear the db file (so I can call my openOrCreateDatabase
method again)
First question: I see all over the web /data/data/PKG/databases/
but where exactly is this stored on a windows machine? It doesn't appear to be in my local project folder because when I do a simple git status
, no *.db
file is listed after the create is successful.
Also if I wanted to clear this is it a simple delete and the emulator will know to re create this? If not how can I clear it from the emulator? (thinking iPhone here where you had to delete and re-push the app to the simulator to clear this out and have the db re-created)
The databases are stored as SQLite files in /data/data/PACKAGE/databases/DATABASEFILE where: PACKAGE is the package declared in the AndroidManifest.
It's stored inside the emulator, not on your machine (at least, not in a place that is easily accessible). Just remove it using adb
:
C:\> adb -e shell rm /data/data/com.example.package/databases/*.db
You can also choose the "Wipe user data" option when launching the emulator AVD, or you can uninstall the application to wipe all data for just that one app:
C:\> adb -e uninstall com.example.package
Finally, you can also just clear user data for a given application without uninstalling it, by going to Settings > Applications > Manage Applications... Select your application, then click the "Clear Data" button.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With