Aravind
Aravind

Reputation: 1255

The linked framework 'Pods_Runner.framework' is missing one or more architectures required by this target: x86_64

I am getting the below error while building my flutter app in IOS simulator via M1 Macbook pro. I am using VS code for editing. I have no issues with the building while building with my iPhone connected to the mac. Any idea how to resolve this.

enter image description here

Launching lib/main.dart on IPhone 13 Simulator in debug mode...
lib/main.dart:1
Xcode build done.                                            1.5s
Failed to build iOS app
Error output from Xcode build:
↳
    objc[10488]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1ffeb6b90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1048c42c8). One of the two will be used. Which one is undefined.
    objc[10488]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1ffeb6be0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1048c4318). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **
Xcode's output:
↳
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    /Users/aravindganesh/Documents/Development/myproject/ios/Runner.xcodeproj: error: The linked framework 'Pods_Runner.framework' is missing one or more architectures required by this target: x86_64. (in target 'Runner' from project 'Runner')
Could not build the application for the simulator.
Error launching application on IPhone 13 Simulator.
Exited (sigterm)

I am adding the x-code configuration below:

enter image description here

Upvotes: 21

Views: 25210

Answers (10)

Stefan Rein
Stefan Rein

Reputation: 9062

Xcode 13.4

Target > Build Settings > Build Options > Allow Multi-Platform Builds: YES

enter image description here

Upvotes: 17

Kanadets0
Kanadets0

Reputation: 21

Had the same problem, but solved.

  1. You can try to add arm64 to the Build Settings -> Architectures -> Excluded Architectures for Any iOS Simulator SDK. It helps many of devs, but for me it didn't work.

  2. You can Clean Build Folder (⇧ + ⌘ + K), clean DerivedData directory, CocoaPods caches, and restart macOS, Xcode and Simulator. This solution works for me.

Upvotes: 2

Vlad R
Vlad R

Reputation: 2634

I had the same issue on my M1 Mac and here is what I did to fix this:

  1. sudo arch -x86_64 gem install ffi
  2. add this code at the end of the pod file which is inside ios folder:
post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
      end
    end
  end
  1. cd ios/ && arch -x86_64 pod install.

  2. run Xcode with Rosetta.
    enter image description here.
    You can install Rosetta by running: softwareupdate --install-rosetta

  3. exclude architecture arm64. enter image description here

  4. clean build - open xcode then press Command + Shift + K


  1. If you're using nvm try to replace NODE_BINARY=node with the actual result of the which node command, which in my case looks something like this:enter image description here
    enter image description here

Shoutout to these answers: one two three

Upvotes: 16

Apix_D
Apix_D

Reputation: 1101

The problem appear on Xcode also.. The issue is, the IDE can't identify the correct architecture. In Xcode open the search (command + space) and type "Xcode". Scroll below and click on "search in finder". Then right click on your Application, in this case - right click on Xcode.app and click on "get Info".

Every application on MacM1 do have the button "Open using Rosetta" in there info. Tick the box and this will fix the issue for Xcode.

I guess the same issue will occure with multiple apps beside Xcode, perhaps on VSCode also.

Upvotes: 2

Andrey Gordeev
Andrey Gordeev

Reputation: 32529

A simple flutter clean solved the problem for me.

Upvotes: 23

Ranier Jardim
Ranier Jardim

Reputation: 66

Just run flutter upgrade. I solved this trouble upgrading my Flutter version from 2.8.0 to 2.10.0 and added exclude arm64 into Xcode too.

Upvotes: 2

Daniel Porteous
Daniel Porteous

Reputation: 6353

Try this from ios/:

rm Podfile.lock Gemfile.lock
gem cleanup
gem update
pod install
open Runner.xcworkspace/  # Do the recommend fixes from the Xcode UI
flutter build ios

This usually does the trick for most of these issues for me.

Upvotes: 1

Supakorn Namkeatsakul
Supakorn Namkeatsakul

Reputation: 29

I just resolved this by downgrade my flutter from 2.8.0 to 2.5.3

Upvotes: 1

Arnaud
Arnaud

Reputation: 11

Got the same issue on my M1, you can solve it by doing

cd ios && arch -x86_64 pod install && cd ../

that should solve the issue :)

Upvotes: 1

wesleyhodaj
wesleyhodaj

Reputation: 72

The problem is related to Xcode configurations. Go to project workspace and then open Runner target excluded architectures and add arm64 so that you can run the app on the emulator. Your problem is closely related to this issue.

Upvotes: 2

Related Questions