Android will refuse to upgrade a package, if it is signed with a different key, making me to uninstall first (and lose user data) and re-install.

If I install the new APK via adb install -r XYZ.apk, I switched to the other APK and kept user data. Is that a correct workaround?


1 Answer 1


Rootless method:

As is mentioned above, you can uninstall an app while keeping its data with adb.

adb shell pm uninstall -k PACKAGE
Do note that it failed to keep data in my test case.

Then you can install the new app with adb install.
Be aware that adb uninstall is invalid as there's no uninstall subcommand for adb. You must connect to a shell on your device and run pm from that shell. However install is a subcommand for adb but it does not take any options, so if you want to run adb install -r you must type in adb shell pm install -r instead.

Root method (Recommended):

If you have root, you should never miss Xposed Framework. Get Xposed Framework and get XInstaller. Navigate to "Installer Settings", scroll down and tick "Disable Signature Check". Now you can install the replacement app in any way you like.

  • 1
    Strange, I did adb install -r XYZ.apk and it worked. The --help says clearly adb install [-lrtsdg] <file>. So please write what is at least true.
    – eudoxos
    Commented Apr 5, 2017 at 19:07
  • 2
    The ad for Xposed, whatever it is, is really not appreciated, either.
    – eudoxos
    Commented Apr 5, 2017 at 19:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .