Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENVFILE must be set #638

Open
xgenem opened this issue Jan 24, 2022 · 5 comments
Open

ENVFILE must be set #638

xgenem opened this issue Jan 24, 2022 · 5 comments

Comments

@xgenem
Copy link

xgenem commented Jan 24, 2022

When I first setup the package in my RN project it was working fine. But somehow along the way the values I am reading from Config become undefined even though I have .env file.

Setting ENVFILE=.env fixed it for me.

$ ENVFILE=.env react-native run-android
$ ENVFILE=.env react-native run-ios

Think this should be added in DOCS?

@Lakshmi254
Copy link

Where should i set ENVFILE=.env? its working fine in android debug mode but in release its not reading .env values

@xgenem
Copy link
Author

xgenem commented Feb 3, 2022

Hi @Lakshmi254 you wanna make sure that when it build it's getting the values inside the .env file.

Make sure you did the EXTRA STEP for Android.
Edit android/app/build.gradle

// 2nd line, add a new apply:
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

@my-name-is-nheo
Copy link

@xgenem even with the extra steps my env is wrong. Happens just in android. My issue here

@pistonsky
Copy link

The reason is because

ReactConfig: Could not find BuildConfig class

@BoilingOil
Copy link

BoilingOil commented Aug 26, 2022

Have lib check for default config with different name than '.env'

This is what the command line is doing when you set ENVFILE=".env.renamed", Android Studio gets it though app/build.gradle.

# in app/build.gradle, above project.ext.envConfigFiles

project.ext.defaultEnvFile = "../__scripts__/.env.dev"

Add if you're using proguard and noticing not seeing things in release builds:

-keep class com.ea.gp.brooklyn.BuildConfig { *; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants