Android Emulator
Installation Error
INSTALL_FAILED_VERSION_DOWNGRADE
Troubleshooting
App Development

Fix INSTALL_FAILED_VERSION_DOWNGRADE on the Android Emulator

Codemia Knowledge Hub ·

INSTALL_FAILED_VERSION_DOWNGRADE means the APK you are installing has a lower versionCode than the version already on the emulator or device. Fix it by uninstalling the existing app (adb uninstall <package_name>), raising versionCode above the installed one, or, for development only, installing with adb install -d to skip the downgrade check.

Why Android refuses the install

When you install an APK, Android's package manager compares its version with the app already installed. If the new APK's version number is lower, the install fails with INSTALL_FAILED_VERSION_DOWNGRADE. During development this usually happens when you deploy different builds of the app to the same emulator without bumping the version number.

versionCode vs versionName

Two attributes, found in AndroidManifest.xml (or set in build.gradle), define an app's version:

  • versionCode: A positive integer that represents the version of the code, used internally.
  • versionName: A string with the release version shown to users.

The package manager uses versionCode to decide whether the installed app is newer. Incrementing versionCode on every release, even during development, avoids downgrade errors.

Three ways to fix it

  1. Uninstall the current version before installing the older one:
bash
     adb uninstall <package_name>
  1. Increment versionCode in build.gradle to a value greater than the installed version. For example, if the current versionCode is 3, change it to 4 or higher:
gradle
1   android {
2       defaultConfig {
3           versionCode 4
4           versionName "1.1"
5       }
6   }
  1. Skip the downgrade check (not recommended) by reinstalling with the -d flag. Do not do this for release builds, because it bypasses the safety check that prevents apps from being downgraded:
bash
     adb install -d path/to/app.apk
Key PointExplanation
Error NameINSTALL_FAILED_VERSION_DOWNGRADE
Primary CauseAttempting to install an older version of an app over a newer one
Critical AttributesversionCode (internal code), versionName (user-facing version)
Resolution MethodsUninstall existing version, increment versionCode, or use -d flag with caution

Preventing it with automatic version bumps

  • CI/CD: Have your pipeline bump the version automatically so nobody has to remember to do it.
  • Gradle scripts: Automate versionCode increments in the build scripts.

Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Basis Lab
No course covers this one yet

Basis Lab writes one for you from a sentence about what you want to be able to do, then teaches it and checks you understood. Your first course is free.

Build my course
Data Structures & Algorithms practice on Codemia

Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.

Practice algorithms