How to run an Android application in an emulator, overwriting old databases?

When I always run the test application in the emulator from Eclipse, by default it never deletes the previous one. It will save the previous copy of the database and files of the same application and run the new compiled code.

What should I do if I want to delete all files and databases associated with the application with each compilation and run it for testing? Any settings for this in Eclipse? I want to avoid the step manually by deleting it before each run. Thanks.

0
source share
3 answers

You can open a command prompt window and run:

adb uninstall your.project.package 

when using adb install with the -r modifier, the application is reinstalled and its data is saved. I did not find a place in Eclipse to change this configuration, but I think that this is done inside the Ant SDK tasks. Check out this class for more info.

+3
source

You can accomplish some of this using the database version in any subclass of SQLiteOpenHelper, and then override onUpgrade to remove all tables. In fact, I believe onUpgrade can also delete known files.

0
source

Does Extrude User Data on the Launch Landing Pages tab do everything for you? I'm not 100% what it wipes out before running the application, but I suspect that it clears all the data. You can try.

0
source

All Articles