-
Notifications
You must be signed in to change notification settings - Fork 658
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
Config is returning an empty object {} despite correct setup in Android #824
Comments
I am experiencing this exact same issue! Works fine in iOS, but the |
@DhanushKG-25, I tried this solution, and it worked for me: #223 (comment). |
I've similar issue I'm using react-native cli not expo. I was upgrading my app with the help of react-native-upgrade helper but whenever i switch the version from 0.73.11 to 0.74.0 the |
The suggestions in this thread didn't resolve it for me (RN 0.76.5) Here's my hack:
God speed developers! EDIT: |
A package in my project needs data from env file using react-native-config package. and I am getting the same empty object |
Ensure the following rules are in android/app/proguard-rules.pro -keep public class **.BuildConfig { *; } |
Show error on log:
|
Changing the value of
"dependencies": {
"expo": "~52.0.27",
"react-native": "0.76.6",
"react-native-config": "^1.5.3"
} |
Description:
I am encountering an issue where
Config
fromreact-native-config
is returning an empty object{}
, even though the.env
file and build configurations are properly set up. I have followed the documentation and verified all steps, but the issue persists.Steps to Reproduce:
react-native-config
in my React Native project..env
file in the project root with the following content:android/app/build.gradle
:Config
object in JavaScript:Expected Behavior:
The
Config
object should contain the variables from the.env.sample-debug
file, e.g.:Actual Behavior:
The
Config
object is returning an empty object:Environment:
1.5.3
0.72.4
16
8.1.1
Ladybug
[email protected]
Troubleshooting Steps Taken:
.env.sample-debug
exists in the project root and has no formatting issues (e.g., no spaces around=
).dotenv.gradle
is being applied by adding a debug log:.env
file is being used.BuildConfig
in the decompiled APK. The variables from.env
were not embedded inBuildConfig
.yarn start --reset-cache
.react-native-config
..env
file (e.g.,TEST_KEY=hello-world
), butConfig.TEST_KEY
was still undefined.Additional Notes:
debug
andrelease
builds../gradlew clean
and rebuilding did not resolve the issue.BuildConfig
after decompiling the APK.The text was updated successfully, but these errors were encountered: