Android install fails because the version on the device is newer
INSTALL_FAILED_VERSION_DOWNGRADEShort 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.
Fix it fast
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.apk2Match what you see, then jump to its fix
- 1
INSTALL_FAILED_VERSION_DOWNGRADE right after switching branches or flavorsYour build has a lower versionCode than the installed appFix - 2
The older versionCode is intentionalYou want to install an older build for testingFix - 3
You do not need the app's dataThe simplest reset: remove the installed app firstFix
- 1
What does the error look like?
INSTALL_FAILED_VERSION_DOWNGRADEFailure [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 installDebugConfirmed by developer.android.com
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 --help2Fix
Use the -d option with adb install. It allows a version code downgrade for that install.
adb install -r -d app-debug.apk3Verify
The command prints Success and the older version runs.
adb install -r -d app-debug.apkConfirmed by developer.android.com
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 myapp2Fix
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.apk3Verify
The install returns Success.
adb shell pm list packages | grep myappConfirmed by developer.android.com
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
adb cannot start because something already holds its port
adb start-server failed
The adb server must bind local TCP port 5037, and every adb client talks to it there.
2 causes, each with a fixMobile apps
The phone shows as unauthorized and Android Studio will not run the app
adb devices lists the phone but Android Studio cannot deploy to it
An unauthorized phone means it has not trusted this computer's RSA key.
3 causes, each with a fixMobile 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 fixMobile apps
adb cannot connect to its daemon or start the server
* daemon started successfully *
The adb server is a background process on your computer that listens on TCP port 5037.
2 causes, each with a fixMobile apps
adb prints 'server version doesn't match this client; killing...'
adb server version doesn't match this client; killing...
adb runs a background server, and every adb command is a client.
3 causes, each with a fixMobile 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