Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Android install fails because the version on the device is newer

ErrorINSTALL_FAILED_VERSION_DOWNGRADE

Short answer

Android blocks an install whose versionCode is lower than the app already on the device. Compare both numbers, then either raise versionCode in Gradle, allow the downgrade for a debug install with adb install -d, or uninstall the app first. Uninstalling removes app data.

  • Applies to Android Gradle Plugin 8, adb 35, Android 14
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Run the install and read the failure line. Then compare the versionCode in your Gradle file with the app already on the device (Settings, Apps, the app, version).

    adb install -r app/build/outputs/apk/debug/app-debug.apk
  2. 2Match what you see, then jump to its fix

    1. 1INSTALL_FAILED_VERSION_DOWNGRADE right after switching branches or flavorsYour build has a lower versionCode than the installed appFix
    2. 2The older versionCode is intentionalYou want to install an older build for testingFix
    3. 3You do not need the app's dataThe simplest reset: remove the installed app firstFix

What does the error look like?

  • INSTALL_FAILED_VERSION_DOWNGRADE
  • Failure [INSTALL_FAILED_VERSION_DOWNGRADE]

Cause 1 of 3

Your build has a lower versionCode than the installed app

1Check

Android uses versionCode to prevent installing an APK with a lower number than the one on the device. Look at defaultConfig, build types and flavors for an override.

grep -rn "versionCode" app/build.gradle*

2Fix

Set a versionCode that is higher than what is installed, and raise it with every release.

android {
    defaultConfig {
        versionCode = 12
        versionName = "1.1"
    }
}

3Verify

Install again and read the installed versionCode.

./gradlew installDebug

Confirmed by developer.android.com

Did this fix it?

Cause 2 of 3

You want to install an older build for testing

1Check

adb install has a flag to allow a version code downgrade.

adb install --help

2Fix

Use the -d option with adb install. It allows a version code downgrade for that install.

adb install -r -d app-debug.apk

3Verify

The command prints Success and the older version runs.

adb install -r -d app-debug.apk

Confirmed by developer.android.com

Did this fix it?

Cause 3 of 3

The simplest reset: remove the installed app first

1Check

Confirm the package name you are removing.

adb shell pm list packages | grep myapp

2Fix

Uninstall the app, then install the older build. Uninstalling removes the app's data unless you pass -k to keep the data and cache directories.

adb uninstall com.example.myapp
adb install app-debug.apk

3Verify

The install returns Success.

adb shell pm list packages | grep myapp

Confirmed by developer.android.com

Did this fix it?

How do I stop it coming back?

  • Increase versionCode on every build you share, and never reuse a number.
  • Keep versionCode in one place (defaultConfig) instead of the manifest, where Gradle overrides it anyway.
  • Use a different applicationIdSuffix for debug builds so they do not collide with release installs.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

Android Studio cannot pair the phone over Wi-Fi

The Pair devices over Wi-Fi dialog lists no device

Wireless pairing needs the phone on Android 11 or higher and on the same Wi-Fi network as the computer, with current Platform-Tools.

4 causes, each with a fix

Mobile apps

adb tcpip 5555 fails because no device is found

adb: more than one device/emulator

adb tcpip only works while the device is attached and listed by adb, because it tells the phone to start listening on port 5555.

4 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.