Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter - iOS: Command /bin/sh failed with exit code 255

Tags:

ios

flutter

Good afternoon,

I try to run a Flutter project on iOS, previously successfully run on Android. However, I got an error:

"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

I tried different solutions offered here about a variety of errors "Command /bin/sh failed with exit code XXX". But, none of them helped.

Also, I checked solutions on GitHub: https://github.com/flutter/flutter/issues/9814. At the same time, it is not completely clear for me how to implement them into iOS project.

I will be appreciated for any support.

Sincerely, Maryna

Update: these are the results of the commands:

$ 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.
like image 794
Mary Seleznova Avatar asked Sep 30 '18 11:09

Mary Seleznova


3 Answers

This exit code (255) occurs from incorrectly Generated.xcconfig configuration like TRACK_WIDGET_CREATION, FLUTTER_FRAMEWORK_DIR, FLUTTER_BUILD_MODE In archive ios release mode. So before archiving make sure to run flutter clean then flutter build ios for some reason flutter build ios --release doesn't work for me. Then lastly go to Xcode and archive the ios app

Commands

flutter clean then

flutter build ios

Hope it helps.

like image 85
Abel Tilahun Avatar answered Sep 21 '22 01:09

Abel Tilahun


I solve the problem with the following commands.

flutter clean
flutter build ios

After that I can create signed builds and also upload to App Stores.

like image 5
abuder Avatar answered Nov 08 '22 14:11

abuder


After lots of try i follow these steps to release ipa file :

  1. Go to your trminal:
  2. cd your-flutter-project
  3. flutter run (That will launch the app to your connected or opened device )

Now, come to again to your MAC terminal and type

  • flutter build apk (that will make the release apk)

For IOS,

  • flutter build ios

after complete the task you will see the path of your file package something like

/Users/Sanjeev/Documents/WorkSpaceForFlutter/myapp/build/ios/iph oneos/Runner.app.

Now go to Xcode >Product >Archive you will get the screen below enter image description here

This is how i resolve my issue Command /bin/sh failed with exit code 255

like image 8
Sanjeev Sangral Avatar answered Nov 08 '22 14:11

Sanjeev Sangral