简体   繁体   中英

How to fix Command PhaseScriptExecution failed with a nonzero exit code - Flutter?

I have built a flutter app. I can run the app in xCode simulator without no problem. But when I try to archive it, it throws the PhaseScriptExecution error. I have tried flutter clean then reinstall the pods again. But to no avail.

Here is my flutter doctor result:

[✓] Flutter (Channel stable, 3.0.1, on macOS 12.4 21F79 darwin-x64, locale
    en-MY)
    • Flutter version 3.0.1 at /Users/admin/Developer/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision fb57da5f94 (6 days ago), 2022-05-19 15:50:29 -0700
    • Engine revision caaafc5604
    • Dart version 2.17.1
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version
    32.1.0-rc1)
    • Android SDK at /Users/admin/Library/Android/sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Users/admin/Downloads/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.51.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 12.4 21F79 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 84.0.4147.105

[✓] HTTP Host Availability
    • All required HTTP hosts are available

And this is the output of flutter build ios

Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/hd/glkbj0nj6ll0c_cgglq_cx400000gq/T/flutter_tools.sxyetd/flutt
        er_ios_build_temp_dirhsbaOo/temporary_xcresult_bundle


    Failed to package /Users/admin/StudioProjects/mymaikapp.
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order

    Result bundle written to path:
        /var/folders/hd/glkbj0nj6ll0c_cgglq_cx400000gq/T/flutter_tools.sxyetd/flutt
        er_ios_build_temp_dirhsbaOo/temporary_xcresult_bundle


Encountered error while building for device.

If it would help, I ran the command flutter run --verbose and put the log here, if it would help tracing what is the error, but I couldn't find it.

flutter run verbose output

Any help would be greatly appreciated. Thank you for your time.

For me, I downloaded flutter 2.10.5 stable, archive it at the same folder with flutter 3.0.2. 1 and then change the flutter sdk path to flutter 2.10.5. 2 Run pub get and then archived it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM