Skip to content

[Android] Fix variantPath for multiflavored paths#2762

Merged
thymikee merged 3 commits intoreact-native-community:mainfrom
Reeywhaar:patch-1
Feb 13, 2026
Merged

[Android] Fix variantPath for multiflavored paths#2762
thymikee merged 3 commits intoreact-native-community:mainfrom
Reeywhaar:patch-1

Conversation

@Reeywhaar
Copy link
Contributor

Summary

When working with multiflavored apps, run-android fails to install app because of incorrect directory. Given we have clientStagingDebug variant, current path is android/app/build/outputs/apk/client/staging/debug when in fact it should be android/app/build/outputs/apk/clientStaging/debug

Test Plan

Try to run-android with some multiflavored app:

android/app/build.gradle should have something like

flavorDimensions "account", "environment"
productFlavors {
    client {
        dimension "account"
        applicationIdSuffix '.client'
        versionCode android.defaultConfig.versionCode
    }
    host {
        dimension "account"
        applicationIdSuffix '.host'
        versionCode android.defaultConfig.versionCode
    }

    production {
        dimension "environment"
        versionCode android.defaultConfig.versionCode
    }
    staging {
        dimension "environment"
        applicationIdSuffix '.staging'
        versionCode android.defaultConfig.versionCode
    }
}

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).

@Reeywhaar Reeywhaar requested a review from cortinico as a code owner February 3, 2026 12:25
Copy link
Member

@cortinico cortinico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we have tests for this?

? `${variantFromSelectedTask.slice(0, -1).join("")}/${variantFromSelectedTask.at(-1).toLocaleLowerCase()}`
: defaultVariant;
// create output file name, eg. `production-debug`
const variantAppName =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also be updated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variantAppName? Seems to be fine

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. Does it get generated as -client-staging-debug?

Copy link
Contributor Author

@Reeywhaar Reeywhaar Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

client-staging-debug to be precise. First dash prepended here. And that is correct, that is what gradle produces

@Reeywhaar
Copy link
Contributor Author

Fixed type error, my bad.

@thymikee
Copy link
Member

@Reeywhaar linter is failing, can you please take a look?

@Reeywhaar
Copy link
Contributor Author

Fixed, sorry once again!

@thymikee thymikee merged commit aff4969 into react-native-community:main Feb 13, 2026
8 checks passed
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.

4 participants