facebook / hermes

A JavaScript engine optimized for running React Native.
https://hermesengine.dev/
MIT License
9.85k stars 631 forks source link

Asset validation failed, hermes contains bitcode. XCode 16 #1525

Closed Drzaln closed 1 month ago

Drzaln commented 1 month ago

Bug Description

When trying to upload my app to AppStore using XCode 16, I get this error

Asset validation failed (90482)
Invalid Executable. The executable '***.app/Frameworks/hermes.framework/hermes' contains bitcode. (ID: 37fb02b5-0173-4c01-8d79-88a9cf6a33d8)

I'm already disable bitcode in the Build Settings

Hermes git revision (if applicable): React Native version: 0.72.4 OS: iOS Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64):

Steps To Reproduce

  1. Enable hermes with react native 0.72.4
  2. Upload the app to AppStore using XCode 16

code example:

The Expected Behavior

tmikov commented 1 month ago

Hi, IIRC, Apple changed their mind on bitcode and and went back and forth about it.

Unfortunately RN 0.72 is no longer supported, but if you upgrade to 0.73 or even better to 0.75, this should address your problem.

davideluque commented 1 month ago

I installed Xcode 15.4 alongside Xcode 16 and managed to build my app.

To do this, I downloaded Xcode 15.4 from https://xcodereleases.com/, unzipped the .xip file, renamed it to Xcode15_4, and moved it to the Applications folder. After launching Xcode15_4 and signing in with my account, I built and distributed the app without any issues.

Edit note: Xcode 15.4 does not run on MacOS 15

Shivangigupta01 commented 1 month ago

I was facing this same issue in RN version: "0.72.6", and was able to resolve it by following this link.

After making the required changes, make sure to clean the project, derived data, install pods again and it should work.

avnshproinfo commented 1 month ago

Yeah same link worked for me, you can fix it by following these steps: fix

anilokcuoglu commented 1 month ago

I was facing this same issue in RN version: "0.72.6", and was able to resolve it by following this link.

After making the required changes, make sure to clean the project, derived data, install pods again and it should work.

This is the solution that worked for me.

abid-mahmood-TS commented 1 month ago

Yeah same link worked for me, you can fix it by following these steps: fix

This was the life saviour, thanks @avnshproinfo

ahmedfaraz587 commented 1 month ago

I am getting this issue in XCode 16 but none of the answers help me to resolve that issue

Upload failed error: Asset validation failed Invalid Executable. The executable '' contains bitcode. (ID: 2aa62af7-6fed-46e2-8405-4946368da620) error: Asset validation failed Invalid Executable. The executable 'mc.app/Frameworks/FBSDKCoreKit.framework/FBSDKCoreKit' contains bitcode. (ID: 1581a6ec-f5d5-4946-908d-18d778fee573) error: Asset validation failed Invalid Executable. The executable 'mc.app/Frameworks/FBSDKCoreKit_Basics.framework/FBSDKCoreKit_Basics' contains bitcode. (ID: e6505282-d042-44f2-9285-995859f32aea) error: Asset validation failed Invalid Executable. The executable 'mc.app/Frameworks/FBSDKLoginKit.framework/FBSDKLoginKit' contains bitcode. (ID: cb690141-2be7-422c-a6c5-2374a91bc335) error: Asset validation failed Invalid Executable. The executable 'mc.app/Frameworks/FBSDKShareKit.framework/FBSDKShareKit' contains bitcode. (ID: 727dc5e1-7bae-40dd-a17a-5f4d0eb4fa18)

fonderkin commented 4 weeks ago

This solution helped me

this

 react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

replace with

bitcode_strip_path = `xcrun --find bitcode_strip`.chop!
   def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
     framework_path = File.join(Dir.pwd, framework_relative_path)
     command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"
     puts "Stripping bitcode: #{command}"
     system(command)
   end

   framework_paths = [
     "Pods/LogRocket/LogRocket.xcframework/ios-arm64/LogRocket.framework/LogRocket",
     "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/hermes",
     "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/Versions/Current/hermes",
     "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64/hermes.framework/hermes",
     "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-maccatalyst/hermes.framework/hermes"
   ]

   framework_paths.each do |framework_relative_path|
     strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
   end
SiHyun-Lee113 commented 4 weeks ago

Please tell me how to find the framework path.

image

anilokcuoglu commented 4 weeks ago

Open the ios/pods/whichframework/frameworks/ios_arm64_v7(this is my chip)/framework.xcframework/framework you must ensure that exact path must be entered otherwise it wont work if you need more assistance please add me on discord im glad to help you

2 Eki 2024 Çar 09:31 tarihinde 이시현 @.***> şunu yazdı:

Please tell me how to find the framework path.

image.png (view on web) https://github.com/user-attachments/assets/670aa2ae-6380-4310-a8fe-010785370824

— Reply to this email directly, view it on GitHub https://github.com/facebook/hermes/issues/1525#issuecomment-2387721787, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARUFM5QW4NVRHRH5FNJYJ6DZZOHLPAVCNFSM6AAAAABOZYTFQOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBXG4ZDCNZYG4 . You are receiving this because you commented.Message ID: @.***>

musti-91 commented 4 weeks ago

It will depends on the framework you're having. I added for Shakebugs SDK also below in the pods "Pods/LogRocket/LogRocket.xcframework/ios-arm64/LogRocket.framework/LogRocket", "Pods/Shake/Sources/Shake.xcframework/ios-arm64/Shake.framework/Shake", # <----- this line "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/hermes", "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/Versions/Current/hermes", "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64/hermes.framework/hermes", "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-maccatalyst/hermes.framework/hermes"

Linuhusainnk commented 3 weeks ago

How can i get the path to be added inside framework paths

junocean commented 2 weeks ago

I am getting this issue in XCode 16 but none of the answers help me to resolve that issue

Upload failed error: Asset validation failed Invalid Executable. The executable '' contains bitcode. (ID: 2aa62af7-6fed-46e2-8405-4946368da620) error: Asset validation failed Invalid Executable. The executable 'mc.app/Frameworks/FBSDKCoreKit.framework/FBSDKCoreKit' contains bitcode. (ID: 1581a6ec-f5d5-4946-908d-18d778fee573) error: Asset validation failed Invalid Executable. The executable 'mc.app/Frameworks/FBSDKCoreKit_Basics.framework/FBSDKCoreKit_Basics' contains bitcode. (ID: e6505282-d042-44f2-9285-995859f32aea) error: Asset validation failed Invalid Executable. The executable 'mc.app/Frameworks/FBSDKLoginKit.framework/FBSDKLoginKit' contains bitcode. (ID: cb690141-2be7-422c-a6c5-2374a91bc335) error: Asset validation failed Invalid Executable. The executable 'mc.app/Frameworks/FBSDKShareKit.framework/FBSDKShareKit' contains bitcode. (ID: 727dc5e1-7bae-40dd-a17a-5f4d0eb4fa18)

you can insert these into Podfile which mentioned, but change to

  bitcode_strip_path = `xcrun --find bitcode_strip`.chop!
    def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
      framework_path = File.join(Dir.pwd, framework_relative_path)
      command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"
      puts "Stripping bitcode: #{command}"
      system(command)
    end

    framework_paths = [
      "Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64/FBSDKCoreKit.framework/FBSDKCoreKit",
      "Pods/FBSDKShareKit/XCFrameworks/FBSDKShareKit.xcframework/ios-arm64/FBSDKShareKit.framework/FBSDKShareKit",
      "Pods/FBAEMKit/XCFrameworks/FBAEMKit.xcframework/ios-arm64/FBAEMKit.framework/FBAEMKit",
      "Pods/FBSDKCoreKit_Basics/XCFrameworks/FBSDKCoreKit_Basics.xcframework/ios-arm64/FBSDKCoreKit_Basics.framework/FBSDKCoreKit_Basics",
      "Pods/FBSDKGamingServicesKit/XCFrameworks/FBSDKGamingServicesKit.xcframework/ios-arm64/FBSDKGamingServicesKit.framework/FBSDKGamingServicesKit",
      "Pods/FBSDKLoginKit/XCFrameworks/FBSDKLoginKit.xcframework/ios-arm64/FBSDKLoginKit.framework/FBSDKLoginKit",
    ]

    framework_paths.each do |framework_relative_path|
      strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
    end
Linuhusainnk commented 2 weeks ago

I am getting this issue in XCode 16 but none of the answers help me to resolve that issue Upload failed error: Asset validation failed Invalid Executable. The executable '' contains bitcode. (ID: 2aa62af7-6fed-46e2-8405-4946368da620) error: Asset validation failed Invalid Executable. The executable 'mc.app/Frameworks/FBSDKCoreKit.framework/FBSDKCoreKit' contains bitcode. (ID: 1581a6ec-f5d5-4946-908d-18d778fee573) error: Asset validation failed Invalid Executable. The executable 'mc.app/Frameworks/FBSDKCoreKit_Basics.framework/FBSDKCoreKit_Basics' contains bitcode. (ID: e6505282-d042-44f2-9285-995859f32aea) error: Asset validation failed Invalid Executable. The executable 'mc.app/Frameworks/FBSDKLoginKit.framework/FBSDKLoginKit' contains bitcode. (ID: cb690141-2be7-422c-a6c5-2374a91bc335) error: Asset validation failed Invalid Executable. The executable 'mc.app/Frameworks/FBSDKShareKit.framework/FBSDKShareKit' contains bitcode. (ID: 727dc5e1-7bae-40dd-a17a-5f4d0eb4fa18)

you can insert these into Podfile which mentioned, but change to

  bitcode_strip_path = `xcrun --find bitcode_strip`.chop!
    def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
      framework_path = File.join(Dir.pwd, framework_relative_path)
      command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"
      puts "Stripping bitcode: #{command}"
      system(command)
    end

    framework_paths = [
      "Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64/FBSDKCoreKit.framework/FBSDKCoreKit",
      "Pods/FBSDKShareKit/XCFrameworks/FBSDKShareKit.xcframework/ios-arm64/FBSDKShareKit.framework/FBSDKShareKit",
      "Pods/FBAEMKit/XCFrameworks/FBAEMKit.xcframework/ios-arm64/FBAEMKit.framework/FBAEMKit",
      "Pods/FBSDKCoreKit_Basics/XCFrameworks/FBSDKCoreKit_Basics.xcframework/ios-arm64/FBSDKCoreKit_Basics.framework/FBSDKCoreKit_Basics",
      "Pods/FBSDKGamingServicesKit/XCFrameworks/FBSDKGamingServicesKit.xcframework/ios-arm64/FBSDKGamingServicesKit.framework/FBSDKGamingServicesKit",
      "Pods/FBSDKLoginKit/XCFrameworks/FBSDKLoginKit.xcframework/ios-arm64/FBSDKLoginKit.framework/FBSDKLoginKit",
    ]

    framework_paths.each do |framework_relative_path|
      strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
    end

How to get these paths for the error, am having issues with OneSignal, JitsiMeet ....

Parth8733 commented 2 weeks ago

I had the same issue, and here's how I resolved it step by step:

  1. Check Hermes Paths
    The paths in the original code might not be correct for your setup. First, you need to find all the Hermes frameworks and their paths within your Pods directory. Run the following command to find all instances of Hermes:

    find Pods/hermes-engine -name hermes
  2. Update Podfile
    Once you have the correct paths, update the framework_paths array in your Podfile to include them. Here's an example of how to do it:

    framework_paths = [
     # Replace these paths with the correct ones you found
     "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64/hermes.framework/hermes",
     "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-simulator/hermes.framework/hermes"
    ]
  3. Strip Bitcode
    Ensure that your Podfile includes the bitcode stripping logic:

    def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
     framework_path = File.join(Dir.pwd, framework_relative_path)
     command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"
     puts "Stripping bitcode: #{command}"
     system(command)
    end
  4. Clean and Build
    After updating the paths, clean your project folder, Then build your project again.

  5. Create the Build
    Finally, try creating the build again (e.g., using eas build or Xcode) and check the result.

junocean commented 2 weeks ago

@Linuhusainnk You can open any code editor and navigate to your project’s root directory. From there, go to ios > Pods, where you'll find relevant folders. The folder names may differ slightly from the examples I provided. Once located, replace them as needed. Remember run pod install to take effect.

LukePJN commented 1 week ago

I found specifying xCode 15.2 in my build scripts solved the issue for me