Appcenter-sdk-react-native: Archive failed with return code: 65

Created on 5 Jun 2020  ·  33Comments  ·  Source: microsoft/appcenter-sdk-react-native

Description

* ARCHIVE FAILED *

The error appears in these 2 files main.jsbundle and assets. Works fine on emulator and physical device

The following build commands failed:

CpResource /Users/runner/runners/2.169.1/work/1/s/ios/main.jsbundle /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/[APPNAME]/InstallationBuildProductsLocation/Applications/DGFonder.app/main.jsbundle
CpResource /Users/runner/runners/2.169.1/work/1/s/ios/assets /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/DGFonder/InstallationBuildProductsLocation/Applications/[APPNAME].app/assets
(2 failures)

##[error]Error: /usr/bin/xcodebuild failed with return code: 65
##[section]Finishing: Xcode build (signed)
##[section]Starting: Xcode build (signed)
### **Repro Steps**

When i try enable to "Legacy Build System"
Please list the steps used to reproduce your issue.I no longer receive this error. But I get an error like

**ld: library not found for -lBVLinearGradient**

ld: warning: directory not found for option '-L-L/Users/runner/Library/Developer/Xcode/DerivedData/DGFonder-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/DGFonder/BuildProductsPath/Release-iphoneos/BVLinearGradient'

clang: error: linker command failed with exit code 1 (use -v to see invocation)`

  1. Enable Legacy build system
  2. check the xcode versiyon local and appcenter

Details

  1. Which version of the App Center SDK are you using?

    • e.g. 1.5.0

  2. Which OS version did you experience the issue on?

    • Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2

  3. What device version did you see this error on? Were you using an emulator or a physical device?

    • e.g. Google Pixel 2 emulator, iPhone X physical device

  4. What third party libraries are you using?

    • example

  5. Run the following command and paste the output below: react-native info

System:
OS: macOS 10.15.3
CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Memory: 59.17 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 14.2.0 - /usr/local/bin/node
Yarn: Not Found
npm: 6.14.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK: Not Found
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6241897
Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_242 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: ^16.13.1 => 16.13.1
react-native: ^0.62.2 => 0.62.2
npmGlobalPackages:
react-native: Not Found

  1. If you're developing for React Native iOS, run the following command and paste the output below: pod --version

pod --version. 1.9.1

  1. Please enable verbose logging for your app using [MSAppCenter setLogLevel: MSLogLevelVerbose]; before your call to [AppCenterReactNative register]; (or any other SDK registration). For Android, use AppCenter.setLogLevel(android.util.Log.VERBOSE); before your SoLoader.init call (you will need to import com.microsoft.appcenter.AppCenter;). Include the logs here:
support

Most helpful comment

@AnastasiaKubova

Finally! I found the problem. Actually, Xcode creates these 2 files while building. I created them manually as you suggested above before, and this has not been a problem until I created the app in the Appcenter.

  • I deleted ios/main.jsbundle and ios/assets files
  • Removed Xcode> Build Phases > Copy Bundle Resource main.jsbundle and asssets

can you explain more?

All 33 comments

Hi there! Let me clarify a little bit. The archive issue happens if you enable Legacy System or the opposite? Is it related to App Center? Looks like the error is unrelated - is it only reproduced with App Center sdk?

If so, could you include the full build log? Thanks.

Hi @annakocheshkova This issue happening only on Appcenter;

The following build commands failed:

CpResource /Users/runner/runners/2.169.1/work/1/s/ios/main.jsbundle /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/[APPNAME]/InstallationBuildProductsLocation/Applications/DGFonder.app/main.jsbundle
CpResource /Users/runner/runners/2.169.1/work/1/s/ios/assets /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/DGFonder/InstallationBuildProductsLocation/Applications/[APPNAME].app/assets
(2 failures)

##[error]Error: /usr/bin/xcodebuild failed with return code: 65
##[section]Finishing: Xcode build (signed)
##[section]Starting: Xcode build (signed)
### **Repro Steps**

And this one When i enable Build System to "Legacy Build System" happening both Appcenter and Physical computer(Xcode or React Native bundler)

**ld: library not found for -lBVLinearGradient**

ld: warning: directory not found for option '-L-L/Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/[APPNAME]/BuildProductsPath/Release-iphoneos/BVLinearGradient'

Hi, @ibrahimyolbir ! Could you please clarify some details:

  • What version of App Center are you use?
  • Does it happen on the empty project?
  • Have you had a chance to share full build log?

Hi @AnastasiaKubova Thank you for helping

"appcenter": "3.0.3",
"appcenter-analytics": "3.0.3",
"appcenter-crashes": "3.0.3",

No its a real project.

Yes i can but not here. i can send it as an mail

Thanks @ibrahimyolbir for share the details. I spent a time for investigate your issue and tried to reproduce it, but it works for me as expected.
Could you please clarify it worked in your project with the previous versions?
It can be related to the cache issue. Could you please try to:

  • rm -rf ~/Library/Developer/Xcode/DerivedData/*
  • rm -rf /Pods && rm Podfile.lock && pod install
  • Build from XCode

And let me know about the result?

@AnastasiaKubova I tried these steps

rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf /Pods && rm Podfile.lock && pod install
Build from XCode

But still same. This is my email adress: [email protected] if you send a mail to me. I can send you the build logs

The following build commands failed:
    CpResource /Users/runner/runners/2.169.1/work/1/s/ios/main.jsbundle /Users/runner/Library/Developer/Xcode/DerivedData/DGFonder-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/DGFonder/InstallationBuildProductsLocation/Applications/DGFonder.app/main.jsbundle
    CpResource /Users/runner/runners/2.169.1/work/1/s/ios/assets /Users/runner/Library/Developer/Xcode/DerivedData/DGFonder-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/DGFonder/InstallationBuildProductsLocation/Applications/DGFonder.app/assets
(2 failures)
##[error]Error: /usr/bin/xcodebuild failed with return code: 65
##[section]Finishing: Xcode build (signed)
##[section]Starting: Xcode build (signed)

@ibrahimyolbir thanks for your reply. If you have any private data in logs you can open a ticket in Intercom and share them there (in App Center portal is message button in the right bottom corner).

@ibrahimyolbir, thanks for sharing logs. I take a look at it, but I don't see any issues related to App Center.
I can suppose the issue is caused in the Build Phases scripts missing some settings.
Could you please try to modify the Build Phases -> Bundle React Native code and images script in Xcode to point it to the correct folder?

export NODE_BINARY=node
../node_modules/react-native/scripts/react-native-xcode.sh

Please let me know about the result.

@AnastasiaKubova Looks right.

Screenshot 2020-06-09 at 08 39 02

As I wrote above, I only encounter this error when building the app in App Center. When I builds it locally, I can build it successfully and I was using an application similar to Appcenter, I did not encounter any problems like this before.

The following build commands failed:

CpResource /Users/runner/runners/2.169.1/work/1/s/ios/main.jsbundle /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/[APPNAME]/InstallationBuildProductsLocation/Applications/DGFonder.app/main.jsbundle
CpResource /Users/runner/runners/2.169.1/work/1/s/ios/assets /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/DGFonder/InstallationBuildProductsLocation/Applications/[APPNAME].app/assets
(2 failures)

##[error]Error: /usr/bin/xcodebuild failed with return code: 65
##[section]Finishing: Xcode build (signed)
##[section]Starting: Xcode build (signed)
### **Repro Steps**

@ibrahimyolbir I try to reproduce it, but unfortunately I can't to get this error. Could you please try to reproduce this issue on an empty project?

@AnastasiaKubova I created an empty project and the installation was completed smoothly. All settings look the same. It will take time to find the problem. If you make a review on what might trigger this error, maybe it might help me. thank you for your help

@AnastasiaKubova its look like, i don t have these 2 files in the empty project (main.jsbundle and asset)

@ibrahimyolbir you can try to create these files via command line:
react-native bundle --entry-file index.js --platform ios --bundle-output ios/main.jsbundle

Then open the Xcode > {Select Project} and add main.jsbundle to Copy Bundle Resource in Build Phases.

@AnastasiaKubova

Finally! I found the problem. Actually, Xcode creates these 2 files while building. I created them manually as you suggested above before, and this has not been a problem until I created the app in the Appcenter.

  • I deleted ios/main.jsbundle and ios/assets files
  • Removed Xcode> Build Phases > Copy Bundle Resource main.jsbundle and asssets

@ibrahimyolbir thank you for explaining! Can you clarify does this solve your issue?

Yes Thank you @AnastasiaKubova

I am glad that the issue is resolved. I'm closing this issue, but feel free to reopen this issue if you have additional questions.

Hi @AnastasiaKubova - I'm experiencing this issue at the moment. I noticed that it is due to the fact I'm passing ios/main.jsbundle in my Copy Bundle Resource similar to @ibrahimyolbir. When I remove the file from Xcode> Build Phases > Copy Bundle Resource main.jsbundle the app center builds passes with no issues.

However this then causes my Test Flight app to crash on launch. I was able to come to this solution because I ran my scheme in release on my own device and it produced an error 'No jsbundle', when the main.jsbundle file was removed from Copy Bundle Resource however when added again it worked as expected...

Would you be able to help me?

Thanks a lot!

Hi there @maxckelly! So you created and passed these files manually similar to @ibrahimyolbir before, right?
What exactly is the error you are getting after? Is it "No JSBundle"?

Hi @annakocheshkova - Thanks for the quick response. Here is everything I've done.

React - "react-native": "0.62.2"

  1. I'm using App center to deploy my iOS app (this is where the issue lies),
  2. I have three schemes for iOS Dev, Beta, Prod (each building fine in xCode),
  3. I'm using Code push as well,
  4. App has been on Test flight working fine for a week

I encountered a build issue "no URL bundle present" when running locally both in debug and in release. However I found a solution for that here: https://www.youtube.com/watch?v=eCs2GsWNkoo which works great. I added the main.jsbundle into build phases >> Copy bundle resources as well which fixed the issue occurring during release. Archiving tests now all works.

However My issue is when I build the app on App Center with the main.jsbundle in Copy Bundle resources the build fails and I believe this is because App Center creates that file itself? The error I face is:

The following build commands failed:
    CpResource /Users/runner/work/1/s/ios/main.jsbundle /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-hjrawomvzxvvvdeuplegfjyupvhr/Build/Intermediates.noindex/ArchiveIntermediates/[APPNAME]/InstallationBuildProductsLocation/Applications/A\ Life\ Lived.app/main.jsbundle
(1 failure)

Knowing this I then went back into xCode and removed main.jsbundle from Copy bundle resources, re ran the build in App Center and it builds successfully...However when it appears on test flight it crashes on startup.

I believe the cause of the crash on Test Flight is due to no main.jsbundle or the one that is produced through App Center if they produce one - The reason I say this is 1. I can't run the app in release locally 2. I did a manual deploy to test flight (archived in xCode, download ipa file, uploaded to App Center, deployed).

I also attempted to build with legacy build system however this then resulted in the below error with App Center:

The following build commands failed:
    Ld /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-hjrawomvzxvvvdeuplegfjyupvhr/Build/Intermediates.noindex/ArchiveIntermediates/[APPNAME]/IntermediateBuildFilesPath/[APPNAME].build/Release-iphoneos/[APPNAME].build/Objects-normal/armv7/A\ Life\ Lived normal armv7
    Ld /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-hjrawomvzxvvvdeuplegfjyupvhr/Build/Intermediates.noindex/ArchiveIntermediates/[APPNAME]/IntermediateBuildFilesPath/[APPNAME].build/Release-iphoneos/[APPNAME].build/Objects-normal/arm64/A\ Life\ Lived normal arm64
(2 failures)

Any ideas on what I could do?

Thanks again for all your help!

I don't think our SDK does anything specific related to jsbundle, but this feels to me like a question more related to the App Center build system.
Could you go over to App Center and open a support ticket there? Our support team should connect you with Build engineering team.

Sure, opened up a ticket. Hopefully can get to the bottom of it.

Thank you for your help @annakocheshkova greatly appreciated.

@maxckelly did you have any luck finding the cause of this? I'm experiencing the same issue

@ben-wright

Unfortunately my solution was to revert back to a stable branch and drop my schemes down to one release and debug.

I'm interested though in finding the cause of this as I spent 4 days on it and still couldn't get to the bottom of it. So please let me know if I can help.

I had three schemes

  • Dev => devDebug
  • Staging => stagingDebug
  • Release => debug

Part of my solution as well was to cut this down to one scheme

  • Release => Debug

The reason I say this is that I had a feeling I may have duplicated the wrong scheme (duplicated a debug scheme but running it at release etc...) this then would've caused issues with code push.

Do you have a similar setup?

It's a very frustrating build issue so if you need anymore help or want to share files etc let me know.

@maxckelly I had the exact same problem as yours and managed to fix it.
First was no URL bundle present, then I added resources and bundle file to ios, it can build but other problems arose. Then I upgraded to RN 0.63.3 then this AppCenter build problem. I deleted main.jsbundle in ios/ and it works.
So to recap:

  1. Upgrade RN to 0.63.3 (it's an easy one with no issue at all from 0.62)
  2. Upgrade Xcode to 12.
  3. Delete main.jsbundle from ios/ folder

Xcode build fine locally, run fine on device.
AppCenter build without issue.

@origamih what do you mean by "I added resources and bundle file to ios" - you added it in xcode some way or how?

I fullfill other conditions but issue still occurs.

@kpietrzak-web run react-native bundle --dev false --entry-file index.js --bundle-output ios/main.jsbundle --platform ios.
Xcode > {Select Project} and add main.jsbundle to Copy Bundle Resource in Build Phases. (then add assets)

@AnastasiaKubova

Finally! I found the problem. Actually, Xcode creates these 2 files while building. I created them manually as you suggested above before, and this has not been a problem until I created the app in the Appcenter.

  • I deleted ios/main.jsbundle and ios/assets files
  • Removed Xcode> Build Phases > Copy Bundle Resource main.jsbundle and asssets

can you explain more?

Seems like a re-occurring issue. I am experiencing it only in AppCenter. Building locally seems to work real fine.

Mine happened after adding 🗡️ OneSignal

Hi @xgenem ! Thanks for getting in touch with us!
Could you please clarify:

  • Which App Center SDK version you use?
  • Which React Native version you use?
  • It happens during local build or on CI?
  • Share the full build log?
  • Did you try to add these steps?

I've added the main.jsbundle to git to be part of the version control and the appcenter build has passed 💪🏻.

However I think this is not what was intended.
the main.jsbundle should be generated as part of the appcenter built and for some reason it does not do it (bug?).
Should I "tell" appCenter explicitly to generate main.jsbundle somehow or is it a bug?

Hi @chenop

Glad you found a solution.

I think your concern is valid and I wouldn't recommend storing main.jsbundle in repo as well, as I believe it should be generated at a build time.
Please check this long-running thread regarding this issue: iOS main.jsbundle will not create automatically or update without manual react-native bundle. And especially this answer, which may work for you. This stackoverflow answer can be helpful tool.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rafaelcorreiapoli picture rafaelcorreiapoli  ·  5Comments

MrLoh picture MrLoh  ·  4Comments

aprilmintacpineda picture aprilmintacpineda  ·  5Comments

elnygren picture elnygren  ·  5Comments

matthargett picture matthargett  ·  7Comments