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
Environment Variables keeps reading from .env #652
Comments
are you using monterey? |
The specific issue from the topic starter is likely because he is building using You can look at https://github.com/luggit/react-native-config/blob/master/android/dotenv.gradle in this repository to see the logic for how the env file is determined. From the logic I don't think it is possible for it to determine the correct env file to use if you are building more than one build variant at a time. In which case it will fallback on .env. As a sanity check you can after building see |
I just updated Android studio & command line tools. Since then, I'm not receiving the the ENVFILE variable (with Could there be a change in the new version of either android studio or command line tools which affects the ability to read this variable? |
Just tried. Using Android Studio Chipmunk on Windows and tested with |
Good point. After retrying without pre-existing daemon running, the This may seem pretty common sense in retrospect, but might still be worth adding a small note to the README for anyone who encounters the same issue. |
Similar thing to what @Mr0cket reports happening here. The Up till now I have had different npm scripts, each doing Now the first run will pick the correct env file, and the ones following will use the same ENVFILE variable, unless the gradle daemon is stopped with Not sure if it can have something to do but I've recently updated my JDK version from JDK 8 to 11 (Zulu OpenJDK as specified in the latest RN docs) and also the Xcode Command Line Tools to 13.2.0. I'm running in Mac M1 |
my solution is |
Not a bad approach. I decided to go with the approach of specifying |
only this worked. "react-native-config": "^1.4.6" "./gradlew --stop" - this helped to reset to .env from .env.beta (no idea how it .env.beta was selected before 🤨) |
This one worked for me finally! |
right above
|
Yes super annoying, seems to be an issue with m1 or montery keeping gradle deamon in memory. For fastlane added the -- stop command in the build script
|
I just stumbled on this as well... the strange this is that it's only affecting one of my projects, not both. |
This one line worked like a charm in my case |
When running it locally the java process also stays running forever on the m1 new mac books, taking quite some memory, so works better to stop the process. gradle( |
from your root folder try this
|
I have a few apps using the same codebase and was attempting to keep the .env files in separate folders. Using the I was wondering if it might be do with the folder containing the per app .env files not being available once the app gets built? It was working in the simulator, but only broke once Xcode built and copied to a physical device |
Yes, worked for me |
Hi , I am still facing this issue ! Can someone please look into this? |
running
./gradlew bundleRelease
to generate app bundles to release to google play store.Debug mode reads correct environment variants with respective .env files. However, all variant's app bundles are being generated with only the .env file.
Root
app/build.gradle
-keep class com.dottid.BuildConfig { *; }
ENVFILE=.env.prod ./gradlew bundleRelease
, but getting a bunch of gradle errors,... without declaring an explicit or implicit dependency
.env
to.env.developer
but then getting a missing env error when i run command./gradlew bundleRelease
Thank you for your time
The text was updated successfully, but these errors were encountered: