Flutter:无法构建 iOS 项目

Flutter: Cannot build iOS project

它是在 android 上工作的项目,但是当我尝试在 iOS 上构建时我做不到,如果也遇到这个问题,请与我分享知识。抱歉我的英语不好。

这是日志文件:

Flutter 崩溃报告;请在 https://github.com/flutter/flutter/issues.

提交

命令

flutter build ios --release

异常

ProcessException: ProcessException: 进程异常退出: 命令行调用: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -列表

2020-05-30 10:58:59.614 xcodebuild[22085:408139] Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON 文本没有以允许不设置片段的数组或对象和选项。} xcodebuild:错误:无法读取项目 'Runner.xcodeproj'。 原因:“Runner”项目损坏,解析错误无法打开。检查项目文件是否存在无效编辑或未解决的源代码管理冲突。

路径:/Users/itinternational/AndroidStudioProjects/shipping_driver/ios/Runner.xcodeproj 命令:/usr/bin/xcodebuild -list

#0      RunResult.throwException (package:flutter_tools/src/base/process.dart:172:5)
#1      _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart:322:19)
<asynchronous suspension>
#2      XcodeProjectInterpreter.getInfo (package:flutter_tools/src/ios/xcodeproj.dart:389:50)
#3      buildXcodeProject (package:flutter_tools/src/ios/mac.dart:108:78)
#4      BuildIOSCommand.runCommand (package:flutter_tools/src/commands/build_ios.dart:83:43)
#5      _rootRunUnary (dart:async/zone.dart:1192:38)
#6      _CustomZone.runUnary (dart:async/zone.dart:1085:19)
#7      _FutureListener.handleValue (dart:async/future_impl.dart:141:18)
#8      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#9      Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#10     Future._completeWithValue (dart:async/future_impl.dart:526:5)
#11     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:36:15)
#12     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:298:13)
#13     ApplicationPackageStore.getPackageForPlatform (package:flutter_tools/src/application_package.dart)
#14     _rootRunUnary (dart:async/zone.dart:1192:38)
#15     _CustomZone.runUnary (dart:async/zone.dart:1085:19)
#16     _FutureListener.handleValue (dart:async/future_impl.dart:141:18)
#17     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#18     Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#19     Future._completeWithValue (dart:async/future_impl.dart:526:5)
#20     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:36:15)
#21     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:298:13)
#22     BuildableIOSApp.fromProject (package:flutter_tools/src/application_package.dart)
#23     _rootRunUnary (dart:async/zone.dart:1192:38)
#24     _CustomZone.runUnary (dart:async/zone.dart:1085:19)
#25     _FutureListener.handleValue (dart:async/future_impl.dart:141:18)
#26     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#27     Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#28     Future._completeWithValue (dart:async/future_impl.dart:526:5)
#29     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:36:15)
#30     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:298:13)
#31     IosProject.productBundleIdentifier (package:flutter_tools/src/project.dart)
#32     _rootRunUnary (dart:async/zone.dart:1192:38)
#33     _CustomZone.runUnary (dart:async/zone.dart:1085:19)
#34     _FutureListener.handleValue (dart:async/future_impl.dart:141:18)
#35     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#36     Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#37     Future._completeWithValue (dart:async/future_impl.dart:526:5)
#38     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:36:15)
#39     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:298:13)
#40     IosProject.buildSettings (package:flutter_tools/src/project.dart)
#41     _rootRunUnary (dart:async/zone.dart:1192:38)
#42     _CustomZone.runUnary (dart:async/zone.dart:1085:19)
#43     _FutureListener.handleValue (dart:async/future_impl.dart:141:18)
#44     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#45     Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#46     Future._completeWithValue (dart:async/future_impl.dart:526:5)
#47     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:36:15)
#48     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:298:13)
#49     XcodeProjectInterpreter.getBuildSettings (package:flutter_tools/src/ios/xcodeproj.dart)
#50     _asyncErrorWrapperHelper.errorCallback (dart:async-patch/async_patch.dart:86:61)
#51     _rootRunBinary (dart:async/zone.dart:1204:38)
#52     _CustomZone.runBinary (dart:async/zone.dart:1093:19)
#53     _FutureListener.handleError (dart:async/future_impl.dart:155:20)
#54     Future._propagateToListeners.handleError (dart:async/future_impl.dart:694:47)
#55     Future._propagateToListeners (dart:async/future_impl.dart:715:24)
#56     Future._completeError (dart:async/future_impl.dart:534:5)
#57     _AsyncAwaitCompleter.completeError (dart:async-patch/async_patch.dart:43:15)
#58     _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart)
#59     _rootRunUnary (dart:async/zone.dart:1192:38)
#60     _CustomZone.runUnary (dart:async/zone.dart:1085:19)
#61     _FutureListener.handleValue (dart:async/future_impl.dart:141:18)
#62     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#63     Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#64     Future._completeWithValue (dart:async/future_impl.dart:526:5)
#65     Future.wait.<anonymous closure> (dart:async/future.dart:402:22)
#66     _rootRunUnary (dart:async/zone.dart:1192:38)
#67     _CustomZone.runUnary (dart:async/zone.dart:1085:19)
#68     _FutureListener.handleValue (dart:async/future_impl.dart:141:18)
#69     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#70     Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#71     Future._addListener.<anonymous closure> (dart:async/future_impl.dart:391:9)
#72     _rootRun (dart:async/zone.dart:1184:13)
#73     _CustomZone.run (dart:async/zone.dart:1077:19)
#74     _CustomZone.runGuarded (dart:async/zone.dart:979:7)
#75     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1019:23)
#76     _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
#77     _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
#78     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#79     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)

扑博士

[✓] Flutter (Channel stable, v1.17.2, on Mac OS X 10.15.5 19F96, locale en-KG)
    • Flutter version 1.17.2 at /Users/itinternational/Downloads/flutter
    • Framework revision 5f21edf8b6 (33 hours ago), 2020-05-28 12:44:12 -0700
    • Engine revision b851c71829
    • Dart version 2.8.3

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/itinternational/Library/Android/sdk
    • Platform android-29, build-tools 29.0.3
    • 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 11.5)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.5, Build version 11E608c
    • CocoaPods version 1.9.3

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

[✓] Connected device (1 available)
    • iPhone SE (2nd generation) • 9AD7BC02-943F-44FE-A4E3-FED33FE669DE • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-5 (simulator)

• No issues found!

尝试删除您的 ios 文件夹并重新创建它 运行 flutter create -i swift .。可能文件夹里面的东西坏了。