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

763 views Asked by At

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.

1

There are 1 answers

0
Rajneesh On

if you want to use any specific version of reat native in nx workspace, then use create Projects with older version of nx workpace as below -

npx [email protected]

this will create react native project with "react-native": "0.67.4",