Is there any way to ignore INSTALL_FAILED_VERSION_DOWNGRADE on application install with the Android Debug Bridge?

105,099

Solution 1

It appears the latest version of adb tools has an "allow downgrade flag" that isn't shown in the adb help, but it is shown in the "pm" help on the device. So use: adb install -r -d <link to apk>

Solution 2

You can try and use adb uninstall -k <package> and then installing the older apk. From the adb usage guide:

  adb uninstall [-k] <package> - remove this app package from the device
                                 ('-k' means keep the data and cache directories)

I've tried it myself with my apk, and it seems to work for most of the data (some data like RawContacts was not saved)

Solution 3

Did you enabled Multiple account on your device (and push your apk via ADB)? If so you have to remove the apk in every account. After complete uninstall, your push will be OK.

Solution 4

For me only this works fine:

adb install -t -r -d myapp.apk

Btw, the app, which I want to replace, and downgrade is a system app

Solution 5

In my case it was a stale version of Google Play Services included with my project. I am using Android Studio. I ran an update on the SDK, and imported the updated library, and that error went away. So my suggestion: update to the latest libraries that are referenced by your project.

Share:
105,099
AaronMT
Author by

AaronMT

Updated on February 16, 2022

Comments

  • AaronMT
    AaronMT over 2 years

    It seems like the most recent Android 4.2 has introduced this error condition on installation when one attempts to install an APK with a lower version. In prior versions of Android, one would be able to install older APK's simply via adb install -r <link to APK>. For debugging purposes, I frequently need to re-test older APK's; and the -r flag would replace the older build in older Android versions. Is there a work-around here to ignore [INSTALL_FAILED_VERSION_DOWNGRADE]?

    • CommonsWare
      CommonsWare over 11 years
      You mean, besides uninstalling the newer version?
    • AaronMT
      AaronMT over 11 years
      Correct; I assumed the -r flag would handle this.
    • m2web
      m2web about 10 years
      This question also valid for cases where you have (somewhat incorrectly) misnumbered builds. E.g. maybe your v1.0 from a dev box has a higher versionCode than v2.0 from a build server.
  • Bahadır Yıldırım
    Bahadır Yıldırım over 10 years
    It appears that this command does not actually execute the uninstall, instead simply yielding a warning. The command to actually excecute this appears to be adb shell pm uninstall -k <package>.
  • jedd.ahyoung
    jedd.ahyoung over 10 years
    Why was this downvoted? It may not be the best answer, but it seems like a viable solution (and perhaps the easiest) for someone who is new to this! Please leave comments for answers like this, as they are essential not only for the answerer, but for the readers who visit this question later. :-|
  • Pointer Null
    Pointer Null about 9 years
    This is also useful for downgrading, if adb -d still complains as it did for me.
  • MarSoft
    MarSoft over 8 years
    Tried with adb install -rd <apkfile> which didn't work. Your versino (with options separated) works fine. Thanks!
  • plaisthos
    plaisthos over 8 years
    And it seems to be documented now! Just not that you have to use -r -d, -rd will not work
  • Derek Gogol
    Derek Gogol about 8 years
    For example, to uninstall (downgrade) Waze 4.0.0.2 and install version 3.9.5.3: adb install -r -d Waze_3.9.5.3.apk. This way you won't lose app data.
  • tasomaniac
    tasomaniac over 7 years
    This is of course something that can be done. It is obvious already. The question is asking if there is a way to skip this check and allow downgrade. And the answer is yes. This answer basically says no.
  • bentolor
    bentolor over 6 years
    Restoring backup via Titanium Backup did not work. Fresh install did not work. Installing via APK and/or adb install did not work. This cost me 1,5h and your simple tip did the trick. Thanks!
  • Darpan
    Darpan almost 6 years
    Since Android 7 (Nougat), adb install -d no longer works unless the package is marked as debuggable. android.googlesource.com/platform/frameworks/base/+/921dd75
  • Benyamin Limanto
    Benyamin Limanto about 4 years
    This doesn't help with anything and should be explained why it need to done this way.
  • sir_brickalot
    sir_brickalot over 3 years
    This helped in the following situation: I uninstalled an app and restored an older version with Titanium Backup. After an automatic app update I tried to downgrade again with TB > hung up on restore; tried installing the APK manually > didn't work with the error "App not installed". So my take away is that TB falesly seems to install apps globally for all users. Samsung S9, Android 9.
  • arekolek
    arekolek over 3 years
    For me it worked when I did adb install -t -r -d app.apk
  • leonidaa
    leonidaa over 3 years
    'grep' is not recognized as an internal or external command, operable program or batch file. grep is working on Unix like OS
  • android developer
    android developer about 3 years
    @Darpan So for signed APKs, it's impossible to install older versions on top of new ones, right?