React-native-config: [Android] How to Assemble Production Release with gradlew?

Created on 5 Oct 2016  路  4Comments  路  Source: luggit/react-native-config

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?

Most helpful comment

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!

All 4 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Quadriphobs1 picture Quadriphobs1  路  3Comments

francisrod01 picture francisrod01  路  3Comments

swl367 picture swl367  路  4Comments

iadcg picture iadcg  路  3Comments

timscott picture timscott  路  5Comments