I have a .env file with my configuration. I am able to successfully create debug builds during development with
ENVFILE=config/.env.development ./node_modules/.bin/react-native run-android
Now, the question, is how to use the config to build a production version of the app with gradlew? I get the following error when running:
cd android && ENVFILE=../config/.env.production ./gradlew assembleRelease
Error:
/Users/jcursi/Sites/joncursi/redbirdNative/android/app/build/intermediates/manifests/full/release/AndroidManifest.xml:46:28-55 : No resource found that matches the given name (at 'value' with value '@string/GOOGLE_MAPS_API_KEY').
Which makes sense, it's saying it is unaware of the config variables. How do we pass these into gradlew?
Being able to actually do a production build is totally critical as all we can do is test. We're in the same boat as @joncursi
If you export the environment variable, instead of merely setting it, export ENVFILE=.env.production it gets picked up by the dotenv.gradle script.
Did that work @joncursi ? Try:
export ENVFILE=.env.production
cd android && ./gradlew assembleRelease
This is exactly what I run to build here. Let us know!
That works, thank you!
Most helpful comment
Did that work @joncursi ? Try:
This is exactly what I run to build here. Let us know!