DEV Community

Discussion on: How to manage staging and production environments in React Native

bobrundle profile image
Bob Rundle • Edited on

Spent quite some getting env files to switch with build type. Discovered that you need to apply dotenv.gradle after envConfigFiles are defined.

project.ext.envConfigFiles = [
    debug: ".env",
    release: ".env",
    stagingrelease: ".env.staging",
    productionrelease: ".env.production"
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"