Xcode 12 - Flutter 应用程序 iOS 构建错误 - 产生了多个命令 / throwToolExit (package:flutter_tools/src/base/common.da

Posted

技术标签:

【中文标题】Xcode 12 - Flutter 应用程序 iOS 构建错误 - 产生了多个命令 / throwToolExit (package:flutter_tools/src/base/common.dart:14:3)【英文标题】:Xcode 12 - Flutter app iOS Build Error - Multiple commands produced / throwToolExit (package:flutter_tools/src/base/common.dart:14:3) 【发布时间】:2020-09-28 05:08:22 【问题描述】:

我正在为 androidios 编译一个颤振应用程序。该项目可以在 android 模拟器上编译和运行,但是当我尝试通过 VSCode 或 Android Studio 构建 iOS 版本时出现构建错误。


这是构建错误:

error: Multiple commands produce
           '/Users/jdoe/Development/My-Great-App/my_great_app/build/ios/Debug-development-iphonesimulator/Runner.app/Runner':
           1) Target 'Runner' has copy command from '/Users/jdoe/Development/My-Great-App/my_great_app/ios/Runner' to
           '/Users/jdoe/Development/My-Great-App/my_great_app/build/ios/Debug-development-iphonesimulator/Runner.app/Runner'
           2) Target 'Runner' has link command with output
           '/Users/jdoe/Development/My-Great-App/my_great_app/build/ios/Debug-development-iphonesimulator/Runner.app/Runner'

[  +49 ms] Could not build the application for the simulator.
[   +3 ms] Error launching application on iPhone 8.
[   +5 ms] "flutter run" took 79,020ms.
[  +18 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:607:7)
           <asynchronous suspension>
           #2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:972:18)
           #3      _rootRunUnary (dart:async/zone.dart:1198:47)
           #4      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #5      _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #6      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #7      Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #8      Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #9      _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
           #10     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
           #11     RunCommand.usageValues (package:flutter_tools/src/commands/run.dart)
           #12     _rootRunUnary (dart:async/zone.dart:1198:47)
           #13     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #14     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #15     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #16     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #17     Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #18     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
           #19     _rootRun (dart:async/zone.dart:1190:13)
           #20     _CustomZone.run (dart:async/zone.dart:1093:19)
           #21     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
           #22     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
           #23     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
           #24     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
           #25     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
           #26     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)

这是我的环境:

jdoe@MacBook-Air My Great App % flutter doctor -v

[✓] Flutter (Channel beta, 1.22.0-12.1.pre, on Mac OS X 10.15.6 19G2021, locale en-CA)
    • Flutter version 1.22.0-12.1.pre at /Users/toddherron1a/Development/flutter
    • Framework revision 8b3760638a (12 days ago), 2020-09-15 17:47:13 -0700
    • Engine revision 4654fc6cf6
    • Dart version 2.10.0 (build 2.10.0-110.3.beta)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/toddherron1a/Library/Android/sdk
    • Platform android-29, build-tools 29.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-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0, Build version 12A7209
    • CocoaPods version 1.10.0.rc.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 49.0.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.49.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.14.1

 
[✓] Connected device (4 available)            
    • AOSP on IA Emulator (mobile) • emulator-5554                        • android-x86    • Android 9 (API 28) (emulator)
    • iPhone 8 (mobile)            • 6F348FD9-AA18-4290-84EA-FB7A1AFB9F9E • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
    • Web Server (web)             • web-server                           • web-javascript • Flutter Tools
    • Chrome (web)                 • chrome                               • web-javascript • Google Chrome 85.0.4183.121

• No issues found!

我尝试过的事情:

flutter clean pod update 从 Xcode 中删除 VALID_ARCH 此应用中没有 facebook 登录,因此 this solution 不适用。

我有点卡住了,我暂时继续在 Android 上进行开发。任何让 iOS 构建工作的想法或想法都将不胜感激!

【问题讨论】:

你是在发布模式还是调试模式下运行命令? 嗨 Sumeet ...我在调试模式下运行它。 【参考方案1】:

问题原来是 Xcode 的 Copy Bundle Resources 中的 GoogleService-Info.plist 文件重复(Targets • Runner • Build Phases) .

使用“-”删除两个副本后,构建工作。

【讨论】:

你是大佬,兄弟 8)

以上是关于Xcode 12 - Flutter 应用程序 iOS 构建错误 - 产生了多个命令 / throwToolExit (package:flutter_tools/src/base/common.da的主要内容,如果未能解决你的问题,请参考以下文章

Xcode 12 - Flutter 应用程序 iOS 构建错误 - 产生了多个命令 / throwToolExit (package:flutter_tools/src/base/common.da

在 Flutter 2 和 XCode 12.5 更新后发生的 Flutter unknown iOS 构建中的错误

如何在 Flutter 中使用 Xcode 12.5 解决 Stripe 支付问题?

Flutter Xcode 12 存档构建失败,符号未定义:_OBJC_CLASS_$_STPAPIClient

IPHONEOS_DEPLOYMENT_TARGET 设置为 8.0 Xcode 12 (Flutter)

带有 Xcode 12.5 的 M1 Mac 从不运行 Flutter 项目