-
Notifications
You must be signed in to change notification settings - Fork 659
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
Empty config even though .env
is filled up
#143
Comments
Same here. .env
.js
|
Problem fixed! I haven't seen the Setup; Running |
react-native link react-native-config didn't do everything for me, but
making the changes manually sorted it out
…On 11 August 2017 at 21:59, Pablo ***@***.***> wrote:
Problem fixed!
I haven't seen the Setup
<https://github.com/luggit/react-native-config#setup>; Running react-native
link react-native-config it worked.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#143 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAY4_pIqFseOTk8xou1Qmfto3mCPaQMtks5sXEIqgaJpZM4Ov9nh>
.
|
having the same issue. @elyobo how you fixed that? |
Carefully went through the instructions and checked that I'd done them all correctly. I realised that the |
How are you creating
I think this should be described on the |
Thanks guys, I was able to fix this issue. There were multiple issues with my project. I was using sudo in all of my commands and it caused some strange issues in auto generated files. Wasted lots of times yesterday and today eventually had to scrape my repo and re-clone it and build it from scratch without sudos. Now it's working. Also, there were issues in linking. First, I was using this plugin without running the link command. Yesterday figured it out and ran link command but since there were strange sudo based issues going on, so it did not work well. So to summarize, use react-native commands without sudo and do run link commands. Hopefully, things will work. |
I'm having the same issues, I followed all the steps for ios and it's still not working. I'm using WebStrom and running via terminal I have tried both |
i am also facing the same issue. Config object is empty. Does anyone find any solution for it |
i have the same issue after upgrading to RN 0.47. |
+1 (react-native: 0.45.11, react: 16.0.0-alpha.12, react-native-config: ^0.6.0 / platform: android, development env: windows 10) |
I fixed it by unlinking and linking it again.
The only problem was i configured it wrongly before and linked it . And later even though fixing the configuration it was not working. Then unlinking and relinking worked |
Tried unlink and link getting the following error ENOENT: no such file or directory, open '/Users/Almog/Full-Time-Employment/Construction-Cloud/RnD/CCMobileApp/android/app/src/main/java/com/ConstructionCloud/CCMobileApp/MainApplication.java' |
Tried to re-link. Also tried version 0.6.0. |
Delete the app from your device or simulator, reinstall and fixed~ |
@DavidKongDesheng that did not work, tried it twice. Everything works fine if you run it from Xcode but that kind of sucks prefer to run everything from terminal. |
I was able to get it working myself. Examine the ruby script:
The location where Once I moved my config files to the correct location, I was able to access the config values. Alternatively, for ios, if you want your files in a different directory you can modify the prebuild script to point to the directory you want to use. I changed I hope this helps. |
the same issue |
I'm having the same issue with v0.6.1. I've ran all my linking correctly (I see the xcode project with the library, etc). However, my Config from my import is an empty object. |
The only solution for me was to remove |
Just dropping a note here to hopefully save someone from doing the same thing I did: Don't put any spaces between the variable name, the equals and the value. Doing this:
Will cause the
|
+1 cannot get it to work. I get the same problem I have tried running the link command, different simulators and doing everything stated in the Setup section in the Readme. |
I managed to solve this by running these commands inside my project:
|
Adding the following line to |
I had the same issue, but @MattHall's solution fixed it for me. |
An addition for (at least) React Native v0.50.4: |
My problem was that |
@RubenO88 If |
Guys, I think this only works when you relaunch a project. ie making modifications to the .env file doesn't take effect until you run the build all over again. Relinking the native code might do it once, by coincidence, but what if you make changes, reload, make more changes, etc? I don't think it takes effect on-the-fly. |
@tmaly1980, is right! You'll need re-build the project every time that your |
This tutorial helped me: https://medium.com/differential/managing-configuration-in-react-native-cd2dfb5e6f7b. |
@elyobo Thank a lot, I've manually added new ReactNativeConfigPackage(). |
Same here.
|
each time i install this package, this issue shows up. |
Yes we should add |
@bericp1 solotuion works for me.
|
I've dug into the module a bit more and how it works is the native code (Swift/Java) generates header files based on the contents of .env. Changes will not show up until the project is cleaned and re-built. The javascript code simply loads the constants defined in the native level code. |
@nlindroos solution is still working and worked for me. I'm using React Native 0.57. I had to manually add the linked library in xcode and everything started working. This, despite the fact that react-native link command all reported back successful. |
log: Could not find BuildConfig class. |
i manage to solve this issue by removing semicolon in the package json this is the script for package.json in this repo's readme
this is my package.json script
i hope this help someone |
I had this problem trying to use build variants for Android. Solved it by doing this in MainApplication.java and then following the 'advanced android setup' step in the readme, but modifying it to be |
If you're using multiple flavors on Android, with different |
@legshampoo I always get this: Is there a linking step for Android? |
Still getting the same issue. I get an empty object for |
@Chepkeitany HI there , i had noticed that the lastest release builds (no longer apk but aab due to new google requirements) with no other changes is turning Config into empty object. Builds are not failing. Have you or others seen this? single .env file |
@jeveloper That's a similar experience. Although I didn't take note when Config was being returned as an empty object. Now that I think about it, I think it was around that time when we switched to aab on the playstore. |
I got it working for Android eventually, here's my setup. (iOS just worked without any manual steps for me)
I'm also using yarn workspaces with the
|
Note that "PACKAGE_NAME_IN_ANDROID_MANIFEST.XML" means:
Yes I felt for it... |
Mine was space at the beginning of the .env file. |
In my case, what fixed the problem was this point: https://github.com/luggit/react-native-config#problems-with-proguard |
is there a fix for this issue at this point of time? doesn't seem to work in js |
I had some issues recently on iOS where changes in my .env file were not reflected in my mobile app.
What did work:
It's not entirely clear whether or not the need to close the simulator is a result of some misconfiguration on my end. |
@dylanhillier |
I use the scripts from within On Android, if my mobile app is running via a simulator, and I make a change to the On iOS, if my mobile app is running via a simulator, and i make a change to the This is inconsistent and undesirable. It would be nice for it to just work via edit: |
Same issue in |
In the code snippet from the RNCConfigModule.java, the package name (stored in the variable This creates an issue when the application Id is different from the To resolve this issue, you should add a new line in the <string name="build_config_package">your_package_name</string> Here, |
I have created a react native app using create-react-native-app and I have this in my main
app.js
In my constructor I have:
console.log(Config.API_KEY)
And in my
.env
file I have:API_KEY = test
That
Config.API_KEY
appears to be undefined.Is this package supposed to work outside of Android and IOS (that is, straight on
app.js
)?The text was updated successfully, but these errors were encountered: