【问题标题】:Xcode build failed after I updated Flutter更新 Flutter 后 Xcode 构建失败
【发布时间】:2021-08-13 05:01:13
【问题描述】:

控制台告诉我以下内容:

Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳

    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'leveldb-library' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'gRPC-Core' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'gRPC-C++' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'gRPC-C++-gRPCCertificates-Cpp' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'abseil' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'BoringSSL-GRPC' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flutter' from project 'Pods')

Could not build the application for the simulator.
Error launching application on iPhone 12.


我是编程新手,不知道该怎么做。

当我运行 flutter build ios --verbose:

[ +380 ms] executing: sysctl hw.optional.arm64
[  +85 ms] Exit code 1 from: sysctl hw.optional.arm64
[   +1 ms] sysctl: unknown oid 'hw.optional.arm64'
[  +24 ms] executing: [/Users/tlobry/Desktop/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +56 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] b22742018b3edf16c6cadd7b76d9db5e7f9064b5
[   +3 ms] executing: [/Users/tlobry/Desktop/flutter/] git tag --points-at b22742018b3edf16c6cadd7b76d9db5e7f9064b5
[ +168 ms] Exit code 0 from: git tag --points-at b22742018b3edf16c6cadd7b76d9db5e7f9064b5
[        ] 2.2.0
[  +24 ms] executing: [/Users/tlobry/Desktop/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +36 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/beta
[        ] executing: [/Users/tlobry/Desktop/flutter/] git ls-remote --get-url origin
[  +33 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[ +356 ms] executing: [/Users/tlobry/Desktop/flutter/] git rev-parse --abbrev-ref HEAD
[  +37 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[   +1 ms] beta
[  +17 ms] executing: sw_vers -productName
[  +46 ms] Exit code 0 from: sw_vers -productName
[        ] Mac OS X
[        ] executing: sw_vers -productVersion
[  +36 ms] Exit code 0 from: sw_vers -productVersion
[        ] 10.15.7
[        ] executing: sw_vers -buildVersion
[  +37 ms] Exit code 0 from: sw_vers -buildVersion
[        ] 19H114
[ +243 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[  +11 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +173 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[  +18 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[  +68 ms] "flutter ios" took 371ms.
[  +87 ms] Target file "lib/main.dart" not found.
[   +7 ms] 
           #0      FlutterCommand.validateCommand (package:flutter_tools/src/runner/flutter_command.dart:1322:9)
           #1      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1148:11)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1043:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand (package:args/command_runner.dart:196:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:284:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:232:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:91:3)
           <asynchronous suspension>
           
           
[ +469 ms] ensureAnalyticsSent: 366ms
[  +10 ms] Running shutdown hooks
[   +1 ms] Shutdown hooks complete
[   +5 ms] exiting with code 1

顺便说一句。 * 告诉我“ 看起来您的帖子主要是代码;请添加更多细节。”但我无法解释更多。有人知道如何绕过这个问题吗?

【问题讨论】:

    标签: xcode flutter dart build


    【解决方案1】:

    Flutter 2.2 支持 IOS 9.0 及更高版本。 阅读supported platforms。 从 Xcode 或您的 pod 文件更改目标版本(转到项目根目录 => ios => Podfile)

    【讨论】:

      【解决方案2】:

      你能提供你的颤振医生输出吗? 你用哪个版本的 Xcode 和哪个版本的 Flutter。

      flutter build ios --verbose 

      【讨论】:

      • 当我运行颤振医生时,没有发现任何问题。我使用 Xcode 12.4 版和 Flutter 2.2.0 版。以下是 Flutter Doctor 摘要: Doctor 摘要(要查看所有详细信息,请运行 flutter doctor -v):[✓] Flutter(Channel beta,2.2.0,在 Mac OS X 10.15.7 19H114 darwin-x64 上,语言环境 de-DE ) [✓] Android 工具链 - 为 Android 设备开发(Android SDK 版本 30.0.3) [✓] Xcode - 为 iOS 和 macOS 开发 [✓] Chrome - 为网络开发 [✓] Android Studio(版本 4.1) [✓]连接的设备(2 个可用) • 未发现问题!
      • 您好,感谢您添加更多信息。您的项目构建目标似乎设置为 8.0,但支持的范围从 9.0 开始。您可以尝试更改构建目标吗?转到项目根目录 => ios => Podfile(打开它)=>(取消注释平台:ios,'8.0')并将其更改为 9.0。告诉我进展如何。