How to access environment variable in androidManifest.xml using react-native-config

Viewed 706

I'm using react-native-config npm for environment property. I can able to access the environment property in JS file. I am unable to access it in androidManifest.xml. I followed through the instruction.

.env

SCHEME = http
HOST = app.com

buildgradlew

defaultConfig {
resValue "string", "build_config_package", "com.geo.vendor"
}

AndroidManifest.xml

<data android:scheme="SCHEME"
              android:host="HOST"/>
1 Answers

According to their docs, the "build_config_package" setting is only for the Android package name / applicationId, not for other values such as the one you are trying to set.

Try it like this:

.env

SCHEME=http
HOST=app.com

AndroidManifest.xml

<data android:scheme="@string/SCHEME"
          android:host="@string/HOST"/>
Related