Skip to content

feat: Allow version code downgrade during run-android - #257

Open
retyui wants to merge 1 commit into
react-native-community:mainfrom
retyui:feat/retyui/apk-downgrade
Open

retyui wants to merge 1 commit into
react-native-community:mainfrom
retyui:feat/retyui/apk-downgrade

Conversation

@retyui

@retyui retyui commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

Super annoying issue:

yarn android --active-arch-only --port 8081
# ^^^ fails with `INSTALL_FAILED_VERSION_DOWNGRADE` if the installed app has a newer version

yarn android --active-arch-only --port 8081 --device emulator-5554
# but if you add `--device` param 💥 NO ERROR at all

Using a --device param force using a CLI (that has -d for adb install ... cmd), see: https://github.com/react-native-community/cli/blob/f4c4ef37ccf98e0205d4a8bc5d9f40f24f1120fd/packages/cli-platform-android/src/commands/runAndroid/tryInstallAppOnDevice.ts#L52

Without--device the app:installDebug task will be used to install an app on all connected devices

Changelog:

[ANDROID] [ADDED] - Allow version code downgrade during run-android

Test Plan:

// 1. New App
npx @react-native-community/cli init --pm yarn --version 0.88.0-rc.6  RN88downgrade
cd RN88downgrade
// 2. Edit `android/app/build.gradle`
// android {
//  defaultConfig {
//        versionCode 999 // <-bump it
//        versionName "9.9.9"

// 3. Run
yarn android --active-arch-only --port 8081
// No error

// 4. Edit one more time `android/app/build.gradle`
//        versionCode 888 // <-lower it
//        versionName "8.8.8"

// 5. Ran again
yarn android --active-arch-only --port 8081
// Error: `INSTALL_FAILED_VERSION_DOWNGRADE`

// 6. Edit one more time `android/app/build.gradle` 
// android {
//    installation {
//        installOptions.add("-d") // <- ADD THIS
//    }


// 7. Ran again
yarn android --active-arch-only --port 8081
// 💥 NO ERROR!

@retyui

retyui commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

@cortinico Could you please review this pr

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants