4

When I install a new version of my .apk, this overwrites the old version without deleting it: In the new version, I deleted some files (libraries generated with NDK) --- but on the device, the old files are still there.

How can I ensure that whenever a new version is installed, all old files will be deleted before the installation?

Edit/Clarification: This question asks for a solution for existing users of my application. I know that I can clean up the application myself by uninstalling it before installing the new version. But other users will not do this --- keeping the old files on their devices.

Yaakov Belch
  • 4,692
  • 33
  • 39
  • possible duplicate of [adb - How to reinstall an app, without retaining the data?](http://stackoverflow.com/questions/12483720/adb-how-to-reinstall-an-app-without-retaining-the-data) – EvZ Aug 08 '13 at 09:46
  • @EvZ --- thanks a lot for the link. I clarified my question. – Yaakov Belch Aug 08 '13 at 09:59

2 Answers2

1

Just before re-installing your application

adb install -r myapp-release.apk

You have 2 options:
First one is to uninstall your application before installing the new version.

adb uninstall com.your.package

Second one is to clear application data before installing the new version.

adb shell pm clear com.your.package
EvZ
  • 11,889
  • 4
  • 38
  • 76
  • Thanks for your help --- I now clarified my question: I need a solution for the standard "one-click" installation process. – Yaakov Belch Aug 08 '13 at 10:01
  • As a "one-click" solution you can write sh or bat with the commands and use it to install the APK in your way. – EvZ Aug 08 '13 at 10:05
0

You could do it manually on your android phone by going to Settings > Applications > [your_app]. Then you can "clear saved data" or something like this.

numpad
  • 96
  • 4