'How to build react native apps specific to an environment in nx.dev

I used nx.dev for my react native application, I have configured the 3 environments. Dev, QA, and Staging. Added productFlavors for the same.

ENVFILE=.env.qa && ./gradlew assembleqaRelease

On running the above command, an app for qa environment is build and it's working as expected.


ENVFILE=.env.qa npx nx build-android merch-app --apk

When the above code is executed, under android/app/build/outputs/apk/ 3 folder are created dev, qa and staging. Only dev app is working, other 2 apps are crashing.

I think it's because of the nx configuration, can someone help me with setting up the nx.json/project.json configuration.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source