下午好,
我尝试在iOS上运行Flutter项目,以前在Android上成功运行过。但是,我遇到了一个错误:
"x86_64" is not an allowed value for option "ios-arch".
Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and options.
Failed to build /Users/user123/Downloads/my_app.
Command /bin/sh failed with exit code 255
我尝试了有关各种错误“命令/ bin / sh失败,退出代码XXX”的解决方案。但是,他们都没有帮助。
我还在GitHub上检查了解决方案: https://github.com/flutter/flutter/issues/9814。 同时,我还不清楚如何将它们实现到iOS项目中。
我们将为您提供的任何支持。
此致, 玛丽娜
更新:这些是命令的结果:
$ flutter run --verbose
[ +53 ms] executing: [/Users/user143726/Downloads/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +60 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/beta
[ ] executing: [/Users/user143726/Downloads/flutter/] git rev-parse --abbrev-ref HEAD
[ +10 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] beta
[ ] executing: [/Users/user143726/Downloads/flutter/] git ls-remote --get-url origin
[ +8 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ ] executing: [/Users/user143726/Downloads/flutter/] git log -n 1 --pretty=format:%H
[ +12 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[ ] 5ab9e70727d858def3a586db7fb98ee580352957
[ ] executing: [/Users/user143726/Downloads/flutter/] git log -n 1 --pretty=format:%ar
[ +13 ms] Exit code 0 from: git log -n 1 --pretty=format:%ar
[ ] 3 weeks ago
[ +1 ms] executing: [/Users/user143726/Downloads/flutter/] git describe --match v*.*.* --first-parent --long --tags
[ +14 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[ ] v0.8.2-0-g5ab9e7072
[ +508 ms] executing: /Users/user143726/Library/Android/sdk/platform-tools/adb devices -l
[ +32 ms] Exit code 0 from: /Users/user143726/Library/Android/sdk/platform-tools/adb devices -l
[ ] List of devices attached
[ +8 ms] executing: idevice_id -h
[ +98 ms] /usr/bin/xcrun simctl list --json devices
[ +449 ms] No connected devices.
[ ] Run 'flutter emulators' to list and start any available device emulators.
[ ] If you expected your device to be detected, please run "flutter doctor" to diagnose
[ ] potential issues, or visit https://flutter.io/setup/ for troubleshooting tips.
[ +18 ms] "flutter run" took 1,014ms.
#0 throwToolExit (package:flutter_tools/src/base/common.dart:26:3)
#1 RunCommand.validateCommand
(package:flutter_tools/src/commands/run.dart:239:7)
<asynchronous suspension>
#2 FlutterCommand.verifyThenRunCommand
(package:flutter_tools/src/runner/flutter_command.dart:350:11)
<asynchronous suspension>
#3 FlutterCommand.run.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command.dart:306:33)
<asynchronous suspension>
#4 AppContext.run.<anonymous closure>
(package:flutter_tools/src/base/context.dart:142:29)
<asynchronous suspension>
#5 _rootRun (dart:async/zone.dart:1124:13)
#6 _CustomZone.run (dart:async/zone.dart:1021:19)
#7 _runZoned (dart:async/zone.dart:1516:10)
#8 runZoned (dart:async/zone.dart:1463:12)
#9 AppContext.run (package:flutter_tools/src/base/context.dart:141:18)
<asynchronous suspension>
#10 FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:297:20)
#11 CommandRunner.runCommand (package:args/command_runner.dart:194:27)
<asynchronous suspension>
#12 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:347:21)
<asynchronous suspension>
#13 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:142:29)
<asynchronous suspension>
#14 _rootRun (dart:async/zone.dart:1124:13)
#15 _CustomZone.run (dart:async/zone.dart:1021:19)
#16 _runZoned (dart:async/zone.dart:1516:10)
#17 runZoned (dart:async/zone.dart:1463:12)
#18 AppContext.run (package:flutter_tools/src/base/context.dart:141:18)
<asynchronous suspension>
#19 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:303:19)
<asynchronous suspension>
#20 CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:109:29)
#21 new Future.sync (dart:async/future.dart:224:31)
#22 CommandRunner.run (package:args/command_runner.dart:109:11)
#23 FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:211:18)
#24 run.<anonymous closure> (package:flutter_tools/runner.dart:59:20)
<asynchronous suspension>
#25 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:142:29)
<asynchronous suspension>
#26 _rootRun (dart:async/zone.dart:1124:13)
#27 _CustomZone.run (dart:async/zone.dart:1021:19)
#28 _runZoned (dart:async/zone.dart:1516:10)
#29 runZoned (dart:async/zone.dart:1463:12)
#30 AppContext.run (package:flutter_tools/src/base/context.dart:141:18)
<asynchronous suspension>
#31 runInContext (package:flutter_tools/src/context_runner.dart:42:24)
<asynchronous suspension>
#32 run (package:flutter_tools/runner.dart:50:10)
#33 main (package:flutter_tools/executable.dart:52:9)
<asynchronous suspension>
#34 main (file:///b/build/slave/Mac_Flutter_Packaging/build/archive/flutter/packages/fl utter_tools/bin/flutter_tools.dart:8:3)
#35 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:287:32)
#36 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
$ flutter analyze
Analyzing my_app...
info • Unused import: 'package:my_app/main.dart' • test/widget_test.dart:10:8 • unused_import
1 issue found. (ran in 8.4s)
$ flutter doctor -v
[✓] Flutter (Channel beta, v0.8.2, on Mac OS X 10.13.6 17G65, locale en)
• Flutter version 0.8.2 at /Users/user143726/Downloads/flutter
• Framework revision 5ab9e70727 (3 weeks ago), 2018-09-07 12:33:05 -0700
• Engine revision 58a1894a1c
• Dart version 2.1.0-dev.3.1.flutter-760a9690c2
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.2)
• Android SDK at /Users/user143726/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.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_152-release-1024-b01)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.0, Build version 10A255
• ios-deploy 2.0.0
• CocoaPods version 1.5.3
[✓] Android Studio (version 3.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 28.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[!] VS Code (version 1.27.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected devices
! No devices available
! Doctor found issues in 2 categories.
答案 0 :(得分:4)
经过大量尝试,我按照以下步骤释放了ipa文件:
现在, 再次来到您的MAC终端并输入
对于IOS,
完成任务后,您将看到文件包的路径,例如
/用户/ Sanjeev /文档/ WorkSpaceForFlutter / myapp / build / ios / iph oneos / Runner.app。
这是我解决问题的方式 命令/ bin / sh失败,退出代码为255
答案 1 :(得分:3)
我用以下命令解决了这个问题。
flutter clean
flutter build ios
之后,我可以创建签名的版本,也可以上传到App Store。
答案 2 :(得分:1)
构建发行版本后,这个问题发生在我身上。看来iOS模拟器不支持发行版。
如果要在模拟器上运行应用,则需要构建调试版本
flutter clean
flutter build ios --debug
答案 3 :(得分:1)
此退出代码(255)来自错误生成的.xcconfig配置,例如TRACK_WIDGET_CREATION,FLUTTER_FRAMEWORK_DIR,FLUTTER_BUILD_MODE
在档案ios发行模式下。因此,在归档之前,请确保先运行flutter clean
,然后再运行flutter build ios
,出于某种原因,flutter build ios --release
对我不起作用。然后最后转到Xcode并存档ios应用
命令
flutter clean
然后
flutter build ios
希望有帮助。
答案 4 :(得分:0)
对我来说,碰巧我正在打开.xcodeproj (WRONG)
文件而不是.xcworkspace (RIGHT)
答案 5 :(得分:0)