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

AndroidInstallationAdb

Android Problem Overview


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]?

Android Solutions


Solution 1 - Android

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 - Android

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 - Android

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 - Android

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 - Android

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.

Solution 6 - Android

I also faced the same problem.It can be resolved with below steps which are easier than deleting any apk from the device -

  1. Run command "adb logcat | grep -i version" on the terminal

  2. Look for the particular line, which will be shown at the end of the logcat -

"Downgrade detected: Update version code 5011  is older than current 9109"
  1. copy the current version( for eg 9109) and paste it in AndroidManifest.xml as shown below -
android:versionCode="9109"

Now clean and rebuild the application and it should work fine.

Solution 7 - Android

Try uninstalling previously installed version of app using-

adb uninstall com.package.name

and then install/run your app again

Solution 8 - Android

You might have installed from a separate copy of the code where the version number was higher than the copy you’re working with right now. In either case, uninstall the currently installed copy, or open up Settings > Apps to determine the version number for the installed app, and increment your versionCode to be higher in the AndroidManifest.

Solution 9 - Android

It may be a problem with the Google Play Services dependencies.

Sometimes, it is NOT the case that:

a) there is an existing version of the app installed, newer or not

b) there is an existing version of the app installed on another user account on the device

So the error message is just bogus.

In my case, I had:

implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'

But when I tried

implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'

I got androidX related errors, as I had not yet upgraded to androidX and was not ready to do so. I found that using the latest 16.x.y versions work and I don't get the error message any more. Furthermore, I could wait till later when I am ready, to upgrade to androidX.

implementation 'com.google.android.gms:play-services-maps:16.+'
implementation 'com.google.android.gms:play-services-location:16.+'
implementation 'com.google.android.gms:play-services-gcm:16.+'

Solution 10 - Android

Uninstall existing installed app.

check if you have changed project package name , Because of package name , It gets conflicts with existing app.

Solution 11 - Android

In my case:

Step 1: Run

yarn start --reset-cache

Step 2: Run

yarn android

Solution 12 - Android

For people facing issues with Xiaomi:

adb shell pm uninstall <package_name>

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAaronMTView Question on Stackoverflow
Solution 1 - AndroidsupereeeView Answer on Stackoverflow
Solution 2 - AndroidTalihawkView Answer on Stackoverflow
Solution 3 - AndroidOlivierTurpinView Answer on Stackoverflow
Solution 4 - Androidhannes achView Answer on Stackoverflow
Solution 5 - AndroidIgorGanapolskyView Answer on Stackoverflow
Solution 6 - AndroidSunitaView Answer on Stackoverflow
Solution 7 - AndroidKrishnaView Answer on Stackoverflow
Solution 8 - AndroidRavindraView Answer on Stackoverflow
Solution 9 - Androidauspicious99View Answer on Stackoverflow
Solution 10 - AndroidJemish RajparaView Answer on Stackoverflow
Solution 11 - AndroidHai DinhView Answer on Stackoverflow
Solution 12 - AndroidVaigunthView Answer on Stackoverflow