Skip to content

[Android] Fix variantPath for multiflavored paths#2762

Open
Reeywhaar wants to merge 2 commits intoreact-native-community:mainfrom
Reeywhaar:patch-1
Open

[Android] Fix variantPath for multiflavored paths#2762
Reeywhaar wants to merge 2 commits intoreact-native-community:mainfrom
Reeywhaar:patch-1

Conversation

@Reeywhaar
Copy link

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
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
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
Author

Fixed type error, my bad.

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