首页 > 解决方案 > 如何修复命令 PhaseScriptExecution 失败并在 macOS 中运行 Flutter 时出现非零退出代码?

问题描述

我正在开发一个颤振应用程序。我最近转移到 macOS,从那时起就无法运行该应用程序。其他应用程序运行良好,所以我认为错误在这个应用程序的代码中。也许由于同样的原因,我无法进行构建。

这是输出flutter doctor

[✓] Flutter (Channel stable, 1.20.1, on Mac OS X 10.15.6 19G73, locale en-US)
    • Flutter version 1.20.1 at /Users/bhawna/dev/flutter
    • Framework revision 2ae34518b8 (4 days ago), 2020-08-05 19:53:19 -0700
    • Engine revision c8e3b94853
    • Dart version 2.9.0

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, set ANDROID_SDK_ROOT to that location.
      You may also want to add it to your PATH environment variable.


 
[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.6, Build version 11E708
    • CocoaPods version 1.9.3

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] VS Code (version 1.47.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.13.2

 
[✓] Connected device (1 available)            
    • iPhone 8 (mobile) • 3D03BDE4-F1A6-45AB-B095-01107CDDC2CD • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-6 (simulator)

输出flutter run

Running "flutter pub get" in delivero...                            1.6s
Launching lib/main.dart on iPhone 8 in debug mode...
 
Running pod install...                                             38.2s
Running Xcode build...                                                  
                                                   
Xcode build done.                                           449.0s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    /Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inapp_purchase-2.2.0/ios/Classes/FlutterInappPurchasePlugin.
    m:45:52: warning: assigning to 'id<IAPPromotionObserverDelegate>' from incompatible type 'FlutterInappPurchasePlugin *__strong'
        [IAPPromotionObserver sharedObserver].delegate = self;
                                                       ^ ~~~~
    /Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inapp_purchase-2.2.0/ios/Classes/FlutterInappPurchasePlugin.
    m:200:79: warning: implicit conversion loses integer precision: 'SKPaymentTransactionState' (aka 'enum
    SKPaymentTransactionState') to 'int' [-Wshorten-64-to-32]
                                                         [NSNumber numberWithInt: item.transactionState], @"transactionStateIOS",
                                                         ~                        ^~~~~~~~~~~~~~~~~~~~~
    /Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inapp_purchase-2.2.0/ios/Classes/FlutterInappPurchasePlugin.
    m:586:71: warning: implicit conversion loses integer precision: 'SKPaymentTransactionState' (aka 'enum
    SKPaymentTransactionState') to 'int' [-Wshorten-64-to-32]
                                                 [NSNumber numberWithInt: transaction.transactionState], @"transactionStateIOS",
                                                 ~                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3 warnings generated.
    /Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/contacts_service-0.3.10/ios/Classes/ContactsServicePlugin.m:6:4:
    warning: 'SwiftContactsServicePlugin' is only available on iOS 9.0 or newer [-Wunguarded-availability]
      [SwiftContactsServicePlugin registerWithRegistrar:registrar];
       ^~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from
    /Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/contacts_service-0.3.10/ios/Classes/ContactsServicePlugin.m:2:
    /Users/bhawna/delivero/delivero/build/ios/Debug-iphonesimulator/contacts_service/contacts_service.framework/Headers/contacts_serv
    ice-Swift.h:213:12: note: 'SwiftContactsServicePlugin' has been marked as being introduced in iOS 9.0 here, but the deployment
    target is iOS 8.0.0
    @interface SwiftContactsServicePlugin : NSObject <FlutterPlugin>
               ^
    /Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/contacts_service-0.3.10/ios/Classes/ContactsServicePlugin.m:6:4:
    note: enclose 'SwiftContactsServicePlugin' in an @available check to silence this warning
      [SwiftContactsServicePlugin registerWithRegistrar:registrar];
       ^~~~~~~~~~~~~~~~~~~~~~~~~~
    1 warning generated.
    /Users/bhawna/dev/flutter/packages/flutter_tools/bin/xcode_backend.sh: line 13: pushd: /Users/hrvoje/Documents/Delivero
    Files/contactsFeature: No such file or directory
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

Could not build the application for the simulator.
Error launching application on iPhone 8.

任何帮助都会很棒。谢谢你的时间。

标签: iosxcodeflutter

解决方案


您不会相信,但在我的情况下,问题是由用于生成启动器图标的损坏图像引起的。阿尔法通道的东西搞砸了。修复后,产品可以成功存档。


推荐阅读