React-native-code-push: CodePush doesn't build - missing libCodePush.a in /Products path at build time

Created on 21 Mar 2018  路  11Comments  路  Source: microsoft/react-native-code-push

Thanks so much for filing an issue or feature request! Please fill out the following (wherever relevant):

Steps to Reproduce

  1. create React Native app and then eject
  2. install codePush by npm and then react-native link
  3. follow 100% of instructions on README

Expected Behavior

App can build

Actual Behavior

App build fails
In Debug mode
In Release mode

Debug mode or Release mode, same result:
clang: error: no such file or directory: '/Users/{my-username}/Library/Developer/Xcode/DerivedData/myapp-cnmaojnjvqijpresrebtdrwvdjzc/Build/Products/Release-iphonesimulator/libCodePush.a'

Reproducible Demo

Environment

  • react-native-code-push version: 5.2.1
  • react-native version: 0.54.2
  • iOS/Android/Windows version: iOS 9.0
  • Does this reproduce on a debug build or release build? both
  • Does this reproduce on a simulator, or only on a physical device? simulator

(The more info the faster we will be able to address it!)

An extra fact to help: In Debug mode, it only fails the FIRST time. When I run build again, it always works the second time.

Most helpful comment

I fixed it this way:

-Click on the project target => Link Binary with Libraries
-Remove libCodePush.a
-Add libCodePush.a file from CodePush.xcodeproj/Products (as opposed to the one from the root directory)

All 11 comments

It may be a clue that libCodePush.a lives both at root and inside of /Products folder in the Workspace:

screen shot 2018-03-20 at 6 54 53 pm

Tail end of build output from my CI:

...

The issue seems to be caused by the way that react-native link connected the library. It resulted in a duplicate entry for file libCodePush.a. Manually removing this has settled the issue.

@octodriver where did you remove the duplicate entry from? I'm stuck with the same error now. Thanks!

@octodriver we are waiting for you response

in the end, i still end up getting the duplicate inside the Libraries/CodePush.xcodeproj, that was not the issue.

What ended up fixing my problem was:

  1. uninstall appcenter & codepush (remove entries from Podfile and then pod install)
  2. updating to the latest cocoapods (sudo gem install cocoapods)
  3. update pod cache (pod update)
  4. reinstall appcenter and codepush (add entries to Podfile and pod install)

My RN version = 0.55.2
My Podfile looks like this:

target 'myapp' do
  platform :ios, '9.0'

  rn_path = '../node_modules/react-native'

  pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
  pod 'React', path: rn_path, subspecs: [
    'Core',
    'CxxBridge',
    'DevSupport',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
  ]

  pod 'AppCenter/Crashes', '~> 1.5.0'
  pod 'AppCenter/Analytics', '~> 1.5.0'
  pod 'AppCenterReactNativeShared', '~> 1.4.0'
  pod 'CodePush', :path => '../node_modules/react-native-code-push'
end

Important note: you have to have target = 9.0 as shown above
also, the latest React (55) has different pod entries from before: 'CxxBridge', 'DevSupport',

I have the same problem, removed duplicates from file {projectname}.xcodeproj

@sobiso thanks I removed duplicates and also worked !

Same here, had duplicate errors as well as missing libCodePush.a after clearing DerivedData.
Our solution was similar to those above:

1) Comment out codepush in podfile
cd ios && pod install && cd ..
react-native unlink code-push-react-native
react-native link code-push-react-native
(uncomment codepush line in podfile)
cd ios && pod install && cd ..
react-native run-ios

Worked like a charm for us.

I just remove tvOS in codepush project.

I fixed it this way:

-Click on the project target => Link Binary with Libraries
-Remove libCodePush.a
-Add libCodePush.a file from CodePush.xcodeproj/Products (as opposed to the one from the root directory)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DeDuckProject picture DeDuckProject  路  3Comments

fanzhiri picture fanzhiri  路  3Comments

chrisjrex picture chrisjrex  路  4Comments

quanzaiyu picture quanzaiyu  路  3Comments

osdnk picture osdnk  路  3Comments