How to run android app in emulator by rewriting old databases?

前端 未结 3 1894
天涯浪人
天涯浪人 2021-01-28 18:15

When I always run app to test in emulator from Eclipse , by default it never uninstalls previous one. It will maintain previous copy of database and files of the same app and ru

相关标签:
3条回答
  • 2021-01-28 18:44

    You can accomplish part of this using a database version in any SQLiteOpenHelper subclasses, then overriding onUpgrade to drop all tables. Actually, I suppose onUpgrade could also delete known files.

    0 讨论(0)
  • 2021-01-28 18:46

    You can have a command prompt window open, and before launching, execute:

    adb uninstall your.project.package
    

    when using adb install with the -r modifier, the app re-installs and its data is saved. I haven't found any place in Eclipse to change this configuration, but I think this is done inside the SDK's Ant tasks. Take a look at this class for more information

    0 讨论(0)
  • 2021-01-28 18:54

    Does the "Wipe user data" under run configurations target tab wipe everything for you? I'm not 100% what it wipes before running the app, but I suspect it clears out all the data. You might give it a try.

    0 讨论(0)
提交回复
热议问题