React-native-config: Issue moving to React Native 0.60.x

Created on 18 Jul 2019  路  12Comments  路  Source: luggit/react-native-config

It's been a slow and tedious effort for the react native update, seems that there is a roadblock with the ios pod setup.

package.json

{
   ...
   "react-native": "^0.60.3",
   "react-native-config": "^0.11.7",
   ...
}

Podfile

target 'MyApp' do 
  ...
  pod 'react-native-config', :path => '../node_modules/react-native-config'
  ...
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    targets_to_ignore = %w(React)

    if targets_to_ignore.include? target.name
      target.remove_from_project
    end

    if target.name == 'react-native-config'
      phase = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
      phase.shell_script = "cd ../../"\
                           " && RNC_ROOT=./node_modules/react-native-config/"\
                           " && export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig"\
                           " && export BUILD_DIR=$RNC_ROOT/ios/ReactNativeConfig"\
                           " && ruby $RNC_ROOT/ios/ReactNativeConfig/BuildDotenvConfig.ruby"

      target.build_phases << phase
      target.build_phases.move(phase,0)
    end
  end
end

Build Path Headers:

  • $(SRCROOT)/../node_modules/react-native-config/ios/ReactNativeConfig (nonrecursive)
  • $(SRCROOT)/../node_modules/react-native-config/ios/** (recursive)

Error:

ld: library not found for -lReactNativeConfig
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Tried to manually react-native link, no dice.
Is anyone else seeing this?

Most helpful comment

I had the same issue, but got it solved by removing the preprocessing step like it's described in the diff of this readme change: https://github.com/luggit/react-native-config/commit/1eb6ac01991210ddad2989857359a0f6ee35d734

All 12 comments

I'm also having trouble upgrading because of this module. Manually linking didn't solve it for me either.

@bsonntag The manual link was not working here also, but after a cd android && ./gradlew clean, the command react-native run-android works again.

@marceloch2 I have no issues with Android, it's only the iOS build that is failing.

Update on my keyboard mashing.

I ended up using react-native init and then manually adding the dependencies into my app and the react-native-config issue disappeared. I think this problem is related to stale references to linked dependencies and the root issue is not specific to react-native-config.

While it was time consuming to do brain surgery from my old to new react native project - I think for the 0.5x to 0.6x transition may be a big enough change to do it this way.

I had the same issue, but got it solved by removing the preprocessing step like it's described in the diff of this readme change: https://github.com/luggit/react-native-config/commit/1eb6ac01991210ddad2989857359a0f6ee35d734

Are there any plans to release a new version on npm with that bugfix ?

@GertjanReynaert
thanks that was the issue, just to add that you need the github master in your package.json not the npm version

I had the same issue, mine is a bit weird. It works on debug mode but not release mode (Android).

package.json

"react-native": "0.60.4",
"react-native-config": "^0.11.7"

Im using auto-linking. when I ran ENVFILE=.env.prod react-native run-android --variant=release. It did shows "Reading env from: .env.prod"

So weird!!

react-native link react-native-config

then update Pod for iOS, Gradle Sync for android. It worked for me!

Happens exactly the same to me. Did you find a solution, @edwinwong90?

Guys! is there any update for that?

Update IT STARTED WORKING
"react-native": "0.61.5", "react-native-config": "^0.12.0"
After spending so much time trying to setup Autolink, I said "fuck it"

  • I ran react-native link react-native-config
    _Note: This one is gonna modify your Podfile, so you should run cd ios && pod install_
  • After that i modified build.gradle file the same way as explained here
  • IT WORKS 馃帀 _But this is still not the perfect solution because the package is installed manually and Autolink will show the warning every time you build the project. But still its a good solution if you need to solve the problem ASAP_

I had the same issue, but got it solved by removing the preprocessing step like it's described in the diff of this readme change: 1eb6ac0

GOD... This saved me! I was stuck on this for days! Thank you for showing me how dumb I can be :)

Was this page helpful?
0 / 5 - 0 ratings