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

RNConfig Empty Android #792

Open
Roasted-Peanut opened this issue Feb 26, 2024 · 3 comments
Open

RNConfig Empty Android #792

Roasted-Peanut opened this issue Feb 26, 2024 · 3 comments

Comments

@Roasted-Peanut
Copy link

import RNConfig from 'react-native-config'

console.log("RNConfig", RNConfig);

IOS can export data, but Android cannot. I tried downgrading the version but to no avail.
"react-native": "0.73.2",
"react-native-config": "^1.5.1",

@Hady207
Copy link

Hady207 commented Apr 23, 2024

Facing the same issue as well
"react-native": "0.73.6",
"react-native-config": "^1.5.1",

@RambousekTomas
Copy link

RambousekTomas commented Jul 20, 2024

The same issue, iOS loads all correctly but Android consfig is empty.
"react-native": "0.73.6",
"react-native-config": "^1.5.2",

Adding proguard rules didn't helped.
#777 (comment)

Fix:
proguard-rules.pro
-keep class com.reservio.BuildConfig { *; }

android/settings.gradle

+ include ':react-native-config'
+ project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android')

android/app/build.gradle

dependencies {
+	implementation project(':react-native-config')
}

+ apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

I was inspired by this #803
And by the fixes to proguard-rules from #777

@zhenkaGo
Copy link

zhenkaGo commented Oct 1, 2024

If you have different flavors, don't miss this step.
https://github.com/lugg/react-native-config?tab=readme-ov-file#advanced-android-setup

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

4 participants