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
- Uninstall the current version before installing the older one:
- Increment
versionCodeinbuild.gradleto a value greater than the installed version. For example, if the currentversionCodeis 3, change it to 4 or higher:
- Skip the downgrade check (not recommended) by reinstalling with the
-dflag. Do not do this for release builds, because it bypasses the safety check that prevents apps from being downgraded:
| Key Point | Explanation |
| Error Name | INSTALL_FAILED_VERSION_DOWNGRADE |
| Primary Cause | Attempting to install an older version of an app over a newer one |
| Critical Attributes | versionCode (internal code), versionName (user-facing version) |
| Resolution Methods | Uninstall 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
versionCodeincrements in the build scripts.
Related reading
- Android Emulator issues in new versions - The emulator process has terminated
- Android emulator not able to access the internet
- Android Endless List
- Android equivalent of NSUserDefaults in iOS
- Android error Failed to install .apk on device timeout
- Android Facebook integration with invalid key hash
- Android equivalent to NSNotificationCenter
- Android Expand/collapse animation
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseNo 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 courseData 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.