I am new to React Native. I’m using react-native-config in a React Native CLI project (not Expo), and it works correctly on iOS but returns an empty object on Android.
Environment:
- react-native: 0.80.1
- react-native-config: 1.1.6
- Using React Native CLI (not Expo)
Issue:
import Config from 'react-native-config';
console.log('1 ::::', Config);
console.log('2 ::::', Config.APP_NAME);
Output on Android:
1 :::: {}
2 :::: undefined
What I’ve tried:
.env file exists in the project root.
Variables are all uppercase:
APP_NAME=MyAppAPP_URL=https://example.comRebuilt the app multiple times (cd android && ./gradlew clean etc.).
iOS builds print the env variables correctly — this happens only on Android.
Related Issues:
I saw similar issues but none of the solutions worked:
react-native-ultimate-configfor this and it works perfectly!