32

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?

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
user3503072
  • 437
  • 1
  • 4
  • 10

13 Answers13

46

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

Martin
  • 657
  • 2
  • 7
  • 8
42

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

Rohit Poudel
  • 1,793
  • 2
  • 20
  • 24
kemuri
  • 478
  • 4
  • 9
  • 7
    Since Android 7 (Nougat), [for security reasons](https://android.googlesource.com/platform/frameworks/base/+/921dd75), `adb install -d` no longer works unless the package is marked as debuggable. – xhienne Jun 05 '18 at 13:45
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.

Tim
  • 41,901
  • 18
  • 127
  • 145
5

just use this:

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

Karl Lu
  • 61
  • 1
  • 2
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.

Ben Weiss
  • 17,182
  • 6
  • 67
  • 87
  • 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. – user3503072 Jul 03 '14 at 09:00
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.

Yusuf
  • 703
  • 8
  • 13
3

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

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

Ajay Takur
  • 6,079
  • 5
  • 39
  • 55
  • Great, but exactly *where* is that versionCode to be found? – andreszs Jul 31 '16 at 20:19
  • 1
    1)Programmatically by manifest file to increment versions. 2)Earlier versions in production go http://stackoverflow.com/questions/14470402/query-the-google-play-store-for-the-version-of-an-app – Ajay Takur Aug 01 '16 at 06:46
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.

Community
  • 1
  • 1
Atul Panda
  • 357
  • 5
  • 20
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.

Krishna Vedula
  • 1,643
  • 1
  • 27
  • 31
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.

Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281
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.

jpp
  • 1
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

user1972814
  • 171
  • 2
  • 6