2

Trying to build and install an app on Android with

./gradlew installDebug

and it fails with INSTALL_FAILED_VERSION_DOWNGRADE. In plain language, this means the APK I am trying to install has a lower version code than the one already on the device—which can happen when switching branches.

I know ADB has a command line option to ignore version codes and force a downgrade; how can I achieve the same when installing through gradle?

user149408
  • 5,385
  • 4
  • 33
  • 69
  • can't you unistall and install again? – karan Jan 08 '19 at 12:58
  • I could, but I would have to take care of backing up all data, restore it and restore the home screen shortcuts, and might have missed something that may come back to bite me later. This is why I want to force a downgrade. – user149408 Jan 08 '19 at 13:02
  • 1
    Found a workaround: locate the generated APK, then do `adb install -d -r /path/to/my.apk`. Still not a perfect solution, though. – user149408 Jan 08 '19 at 13:07

0 Answers0