0

I was using VSCode to archive an ios .ipa. When I tried "flutter build ios --release", it failed with message: " Command PhaseScriptExecution failed with a nonzero exit code". I google this error and found many solutions, but none of them works for me. These solutions refer to "Key Chain Access","delete pods and clean build folder" and so on. I even update my MacOS system and 'XCode' to the newest version, but no miracle happens. Finally I found an useful command "flutter build ios --release -v" to show the detail info, here is the log on VSCode:

[   +6 ms] Encountered error while building for device.
[   +2 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      _BuildIOSSubCommand.runCommand (package:flutter_tools/src/commands/build_ios.dart:277:7)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1125: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:209:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:288: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:236: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:92:3)
           <asynchronous suspension>

It seems like something wrong with my dart SDK, I'll be appreciate anyone helps me.

PS: This strange error only shows in my own MacBook Pro, it packages smoothly when I run the build command in my company's MacBook Pro.

7
  • Did you run the project on an android emulator? Commented Dec 3, 2021 at 6:28
  • 1
    Thank you, I never run the project on an android emulator, but I can package an android apk and install it on real android device. The apk just runs fine. Commented Dec 3, 2021 at 6:50
  • It can runs both on iOS simulator and my iPhone. Commented Dec 3, 2021 at 7:07
  • 1
    Strange,ha? This error only happens when I try packing an iOS ipa Commented Dec 3, 2021 at 7:09
  • I have never been faced with a strange issue like this. I think removing SDK and reinstalling it or restarting Vs code can fix it. When you solve your Question please let me know what the issue was. Commented Dec 3, 2021 at 7:12

1 Answer 1

1

you can try running the command:

flutter clean

rm -rf ios/Flutter/Flutter.framework

flutter build ios --release

OR uninstall flutter's SDK and try reinstall it again.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you, I tried the command but still get the error "Command PhaseScriptExecution failed with a nonzero exit code". I'll try your last suggestion and see if it works ): .
I solve this problem with your last suggestion "uninstall flutter and reinstall it", Thanks!
that's fine....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.