Skip to content

feat(android): pass -Pandroid.adbOptions.installOptions=-d by default in run-android - #2882

Merged
cortinico merged 1 commit into
react-native-community:mainfrom
retyui:feat/android-install-downgrade
Nov 9, 2026
Merged

cortinico merged 1 commit into
react-native-community:mainfrom
retyui:feat/android-install-downgrade

Conversation

@retyui

@retyui retyui commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Summary:

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

Important

Using a --device param force using a CLI (that has -d for adb install ... cmd), see:

const installArgs = ['-s', device, 'install', '-r', '-d'];

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

Changelog:

[ANDROID] [CHANGED] - 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 (like -Pandroid.adbOptions.installOptions=-d)
//    }


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

Checklist

  • Documentation is up to date.
  • Follows commit message convention described in CONTRIBUTING.md.
  • For functional changes, my test plan has linked these CLI changes into a local react-native checkout (instructions).

@retyui

retyui commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@cortinico Thanks for the approval! Anything else needed before this can be merged? Happy to adjust. Related: react-native-community/template#257

@retyui

retyui commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@cortinico Thanks for the approval! Anything else needed before this can be merged? Happy to adjust.

@cortinico
cortinico merged commit 59e4a19 into react-native-community:main Nov 9, 2026
4 of 8 checks passed
@retyui
retyui deleted the feat/android-install-downgrade branch November 9, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants