链接的框架“Pods_Runner.framework”缺少此目标所需的一个或多个架构:x86_64

ara*_*ind 21 xcode ios dart visual-studio-code flutter

我在通过 M1 Macbook pro 在 IOS 模拟器中构建 flutter 应用程序时遇到以下错误。我正在使用 VS 代码进行编辑。\n在使用连接到 Mac 的 iPhone 进行构建时,我的构建没有出现任何问题。\n知道如何解决此问题。

\n

在此输入图像描述

\n
Launching lib/main.dart on IPhone 13 Simulator in debug mode...\nlib/main.dart:1\nXcode build done.                                            1.5s\nFailed to build iOS app\nError output from Xcode build:\n\xe2\x86\xb3\n    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.\n    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.\n    ** BUILD FAILED **\nXcode\'s output:\n\xe2\x86\xb3\n    note: Using new build system\n    note: Planning\n    note: Build preparation complete\n    note: Building targets in dependency order\n    /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\')\nCould not build the application for the simulator.\nError launching application on IPhone 13 Simulator.\nExited (sigterm)\n
Run Code Online (Sandbox Code Playgroud)\n

我添加下面的 x 代码配置:

\n

在此输入图像描述

\n

And*_*eev 23

一个简单的flutter clean解决了我的问题。


Ste*_*ein 18

Xcode 13.4

目标>构建设置>构建选项>允许多平台构建:是

在此输入图像描述

  • 这对我来说很有效。谢谢! (2认同)

Vla*_*nin 16

我在我的M1 Mac上遇到了同样的问题,以下是我解决此问题的方法:

  1. sudo arch -x86_64 gem install ffi
  2. 在 ios 文件夹内的 pod 文件末尾添加以下代码:
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
Run Code Online (Sandbox Code Playgroud)
  1. cd ios/ && arch -x86_64 pod install。

  2. 使用 Rosetta 运行 Xcode。
    在此输入图像描述。
    您可以通过运行以下命令来安装 Rosetta:softwareupdate --install-rosetta

  3. 排除架构arm64。 在此输入图像描述

  4. 干净的构建 - 打开 xcode 然后按 Command + Shift + K


  1. 如果您使用nvm尝试替换NODE_BINARY=node为命令的实际结果which node,在我的例子中,它看起来像这样:在此输入图像描述
    在此输入图像描述

大声喊出这些答案: 一 二三

  • 步骤 2、3、4 和 5 并运行对我有用 (2认同)