Android_Install failed version downgrade
Asked Answered
K

13

35

I'm going to update my apk on GooglePlay Store and I know that i have to upgrade the version code and name in manifest file however, it made install_failed.

Installation error: INSTALL_FAILED_VERSION_DOWNGRADE 

Please check logcat output for more details. Launch canceled!

I modified the version code and name like this: android:versionCode="2" android:versionName="1.0.5"

Did i make it wrong?

Krause answered 3/7, 2014 at 7:46 Comment(0)
O
51

Just uninstall the application on your device first and then install the fresh one.

Operant answered 6/1, 2016 at 20:28 Comment(2)
Perfect. You made my day. ThanksSubgroup
This will erase any configuration i have in my application. I preffer use adb install -d -r your.apk as said @kemuri.Southwester
P
44

When you are installing via adb you can pass -d to allow version downgrade

adb install -d -r your.apk

-r will also replace the existing app

Pericycle answered 18/7, 2017 at 7:53 Comment(1)
Since Android 7 (Nougat), for security reasons, adb install -d no longer works unless the package is marked as debuggable.Centrosymmetric
W
9
Installation error: INSTALL_FAILED_VERSION_DOWNGRADE Please check logcat output for more details. Launch canceled!

I solved it by using the command prompt,navigating to project folder >adb uninstall package (you can get the package from Manifest.xml file).

In my case : D:\projectFolder\AndriodApp>adb uninstall com.example.app

Again launch the App in emulator or mobile.

Wright answered 9/12, 2015 at 10:48 Comment(0)
B
5

just use this:

$ adb -e uninstall your.application.package.name

Bartram answered 22/2, 2016 at 3:26 Comment(5)
Please explain your solution.Subcartilaginous
This command executes an uninstall on a running emulator instance. This doesn't answer the question.Devitalize
This sped up my db migration testing by a factor of 2! Thank youLarcener
You should drop the -e flag when not using an emulator.Morgan
Sometimes a device restart is also required after doing this.Just
M
4

Apparently the versionCode of your currently installed version of the application is greater than 2, thus resulting in a failed installation on the device.

Mclaurin answered 3/7, 2014 at 7:48 Comment(1)
I made the version code to "105" however i got a dialog "Error, please restart application error code : 20 " on my device. I can't find error on Logcat. Do you have any idea with it? I have no clue.Krause
S
4

This happen when your installed apk version less than version by which you are trying to build apk. For example you just upgrade your version and try to build apk with it but you already a installed apk in your device which was build by the previous one.

In this case you must uninstall the previous apk and build a new one with the exiting version.

Submarginal answered 3/8, 2017 at 9:56 Comment(0)
S
3

I just disabled it first in setting>apps>allapps>app and I was able to install using regular command: adb -r name.apk

Silo answered 23/8, 2018 at 19:21 Comment(0)
M
2

First thing you need to do is check versionCode and versionName for palystore apk and then increment number by one for both versionCode and versionName.

for instance:in playstore versionCode="42"and versionName="1.4.2" then change it versionCode="43" and versionName="1.4.3" in your latest code

Malkin answered 11/11, 2014 at 22:52 Comment(2)
Great, but exactly where is that versionCode to be found?Snaggy
1)Programmatically by manifest file to increment versions. 2)Earlier versions in production go #14470902Malkin
O
1

Ajay Takur is correct. Your App's current version code should be greater than the playstore one.

But do refer to this answer once. It may solve your problem.

Orabelle answered 19/7, 2015 at 9:34 Comment(0)
G
0

In my case, I had to remove and uninstall the version on the device and then running the project. It reinstalled the version in the IDE and it worked like a charm.

Gurevich answered 2/10, 2015 at 12:7 Comment(0)
D
0

Another take on the same error message: in Android Studio (unlike Eclipse), the version code/name are listed in the gradle file. If they're present both there and in the manifest, the gradle ones take precedence.

Discommend answered 23/2, 2019 at 14:51 Comment(0)
S
0

Spent an hour beating my head against the wall on this so want to share a specific quirk. Uninstalling the app via the headset didn't work - this error message still appeared, but uninstalling via sidequest and then installing the new apk worked. Good luck out there.

Suppositious answered 19/12, 2022 at 15:40 Comment(0)
C
0

Since i just had do a (split apk) downgrade again within less than a week here is how it goes, assuming you have USB debugging enabled and an adb shell:

  1. Copy the folder with your apk's to /data/local/tmp since pm can't create an install session on /sdcard

  2. Change to the folder and create a new install session with the total size (in bytes) of all apk's, e.g: pm install-create -d -S 54900430‬ (mind the -d switch which isn't documented in my pm - on AOSP 12 - to enable downgrades)

    -rw-rw---- 1 shell shell 39416921 2023-03-12 06:14 com.example.android.apk
    -rw-rw---- 1 shell shell 12141876 2023-03-12 06:14 config.arm64_v8a.apk
    -rw-rw---- 1 shell shell 749977 2023-03-12 06:14 config.en.apk
    -rw-rw---- 1 shell shell 2591656 2023-03-12 06:14 config.xxhdpi.apk

  3. Add each apk to the install session with its size and incrementing index, replace SESSIONID with the session id returned from pm install-create:

    pm install-write -S 39416921 SESSIONID 0 com.example.android.apk
    pm install-write -S 12141876 SESSIONID 1 config.arm64_v8a.apk
    pm install-write -S 749977 SESSIONID 2 config.en.apk
    pm install-write -S 2591656 SESSIONID 2 config.xxhdpi.apk

  4. Finally commit the session using pm install-commit SESSIONID

If everything worked the shell will return Success

Cheers

Creative answered 12/3, 2023 at 5:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.