android
install_error
ai_generated
true
INSTALL_FAILED_VERSION_DOWNGRADE:现有版本代码 2 大于新版本代码 1
INSTALL_FAILED_VERSION_DOWNGRADE: Existing version code 2 is greater than new version code 1
ID: android/install-failed-version-downgrade
95%修复率
90%置信度
1证据数
2023-01-10首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Android 12 | active | — | — | — |
| Android 13 | active | — | — | — |
| Android 14 | active | — | — | — |
| Android Studio Giraffe 2022.3.1 | active | — | — | — |
| Android Studio Hedgehog 2023.1.1 | active | — | — | — |
根因分析
尝试安装版本代码低于当前已安装应用的 APK,Android 出于安全原因阻止此操作。
English
Attempting to install an APK with a lower versionCode than the currently installed app, which Android prevents for security reasons.
官方文档
https://developer.android.com/studio/command-line/adb#install解决方案
-
Uninstall the existing app first: `adb uninstall com.example.app`, then install the new APK.
-
Increment versionCode in build.gradle: `versionCode 3` (ensure it's higher than previous) and rebuild.
无效尝试
常见但无效的做法:
-
30% 失败
Uninstalling the app manually from device settings works but loses all user data; not ideal for debugging.
-
90% 失败
Using `adb install -r -d` flag may force downgrade on some custom ROMs but fails on stock Android with version downgrade check.
-
100% 失败
Modifying versionName only without changing versionCode has no effect because versionCode is the numeric identifier.