类 AMSupportURLConnectionDelegate 在两者中都实现

e-j*_*-j5 39 ios flutter

我正在尝试在 M1 mac 上构建一个 flutter 应用程序并收到以下错误。

$ flutter build ios --release
Building XXX for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: XXX
Running pod install...                                             13.2s
Running Xcode build...
Xcode build done.                                            6.7s
Failed to build iOS app
Error output from Xcode build:
?
    objc[65074]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1f66de518) and ?? (0x1160d82b8). One
    of the two will be used. Which one is undefined.
    objc[65074]: Class AMSupportURLSession is implemented in both ?? (0x1f66de568) and ?? (0x1160d8308). One of the two
    will be used. Which one is undefined.
    ** BUILD FAILED **


Xcode's output:
?
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    error: The linked framework 'Pods_Runner.framework' is missing one or more architectures required by this target:
    armv7. (in target 'Runner' from project 'Runner')

Encountered error while building for device.
Run Code Online (Sandbox Code Playgroud)

这是我的 flutter doctor -v

flutter doctor -v
[?] Flutter (Channel stable, 1.22.4, on macOS 11.0 20A2411 darwin-arm, locale en-AU)
    • Flutter version 1.22.4 at /Users/mlee/development/flutter
    • Framework revision 1aafb3a8b9 (3 weeks ago), 2020-11-13 09:59:28 -0800
    • Engine revision 2c956a31c0
    • Dart version 2.10.4


[?] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/mlee/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[?] Xcode - develop for iOS and macOS (Xcode 12.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.2, Build version 12B45b
    • CocoaPods version 1.10.0

[!] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    ? Flutter plugin not installed; this adds Flutter specific functionality.
    ? Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[?] VS Code (version 1.51.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.16.0

[?] Connected device (2 available)
   

! Doctor found issues in 1 category.
Run Code Online (Sandbox Code Playgroud)

Kay*_*y V 56

首先尝试一个简单的、有记录的步骤

在终端中:

sudo xcode-select -r
Run Code Online (Sandbox Code Playgroud)

解释

该命令将 xcode 重置为默认路径(请参阅下面的文档摘录)。这个命令

  • 为我解决了这个问题并且
  • 避免了引入陌生人随机的、未记录的想法的风险。

这些优点使其值得首先尝试,特别是因为记录的方法通常不会干扰未来的版本升级。可能需要首先撤消实验性解决方法。

文档

% xcode-select -h
Usage: xcode-select [options]

Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example, 
xcodebuild) as well as the BSD development commands (such as cc and make).

Options:
  -h, --help                  print this help message and exit
[...]
  -r, --reset                 reset to the default command line tools path
Run Code Online (Sandbox Code Playgroud)

  • 它对我有用......不过,欢迎来到“软件工程”的新时代。谷歌搜索错误,在没有真正理解的情况下输入一些内容。“嘭,嘭!” 一切都完成了……一切都在不知道到底发生了什么的情况下。我的同事也用这种方式“编程”,“npm install XYZ”和“Boom,Bam!” 完成了 (11认同)

小智 10

我遇到过同样的问题。我在运行时看到了同样的错误flutter build ios

错误消息在我的 VS 代码终端上显示为红色,但有点误导。我发现这不是主要问题。

实际问题应该在以下错误部分。

因此,请运行flutter build ios --verbose并仔细阅读输出。

在我的情况下,还有其他失败的问题flutter build ios。问题如忘记放入GoogleService-Info.plist或iOS目标版本低于flutter包的要求。


JJu*_*ice 9

得到同样的错误,也在 M1 macbook 上。通过以下方式修复它:

  1. flutter clean 项目目录里面。
  2. flutter build ios
  3. “开始调试”(与代码)。

  • 在 M1 MacBook 上遇到同样的问题。但无法解决 (4认同)

e-j*_*-j5 7

不知怎的,我设法通过删除flutter/bin/cache文件夹来解决这个问题。这可能是我为解决这个问题所做的其他随机事情的组合。

我尝试过的事情。

  1. 使用 Rosetta 运行终端。
  2. 升级依赖版本以及运行flutter pub upgrade
  3. 消除ios/PodsPodfile.lock
  4. 重新组织xcconfig文件 - 确保包含Generated.xcconfig
    • 我已经创建base.xcconfig并使用现有的配置它Pods-Runner.release.xcconfig

这是我的base.xcconfig

#include "Generated.xcconfig"
#include "Env-defaults.xcconfig"
#include "Env.xcconfig"
Run Code Online (Sandbox Code Playgroud)


Lui*_*is 7

我在 Mac 上使用 M1 芯片时遇到了同样的错误。我创建了一个新项目,并意识到新项目构建设置排除 Any IOS Simulator SDK: arm64 i386

在“排除的架构”下

在此输入图像描述

  • 那么有什么办法解决呢? (4认同)

小智 6

安装 ffi 帮助了我。我从过去两天被困住了,然后我终于找到了这个解决方案。

arch -x86_64 sudo gem install ffi 如果您使用的是 m1,请使用它

sudo gem install ffi 如果你是 intel Macs

谢谢希望这会奏效。

  • 作为 m1 用户,ffi 中断了“pod install”命令,我不知道为什么会发生这种情况。卸载解决了我的问题,只是想说:/ (2认同)

Rob*_*way 6

终于让它工作了——这是我必须从项目根目录开始做的事情:

cd ios
rm -rf ~/Library/Caches/CocoaPods
rm -rf Podfile.lock
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
Run Code Online (Sandbox Code Playgroud)

然后:

pod deintegrate
pod setup
pod install
Run Code Online (Sandbox Code Playgroud)


Gok*_*rni 6

对于在 M1 上遇到此问题的任何人,请运行 Rosetta 的 iTerm/Terminal。请按照以下命令操作。

罗塞塔的安装,

softwareupdate --install-rosetta
Run Code Online (Sandbox Code Playgroud)

从罗塞塔出发,

  1. 转到应用程序文件夹。
  2. 右键单击 iTerm >> Get Info
  3. 查看open using Rosetta

就这样打开终端,问题就解决了。


小智 5

我用 flutter create 创建的新应用程序中的新文件替换了所有 /app/ios 文件