I'm trying to implement environments in the react-native application.
For the android, I have the following configuration:
.
.
project.ext.envConfigFiles = [
dev: ".env.dev",
qa: ".env.qa",
]
.
.
productFlavors {
qa {
applicationId "com.myapp.qa"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
resValue "string", "build_config_package", "com.myapp"
}
dev {
applicationId "com.myapp.dev"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
resValue "string", "build_config_package", "com.myapp"
}
}
npx nx run-android my-app --variant=devDebug --appIdSuffix=dev
the above command is working as expected, it is taking env variables from .env.dev and creating dev apk.
The issue am I facing is with the build command. I think build-android doesn't have options like run-android. It's building both the dev and QA apps.
npx nx build-android my-app --apk
Does anyone have any idea on how to pass options to build-android?
In latest(14.X.X) nx workspace, there is an option to pass custom assemble/bundle task using
gradleTask
.e.g.
I might need to to append
release
ordebug
to following config