Flutter无法打包,命令PhaseScriptExecution失败,退出代码为非零

pbgvytdp  于 2023-05-01  发布在  Flutter
关注(0)|答案(2)|浏览(240)

在我的flutter应用程序中,当我尝试在模拟器或真实的设备上运行应用程序时,它会显示以下消息,没有错误详细信息(我使用Mac M1):
Android Studio错误是:

Running pod install...
Running Xcode build...
Xcode build done.                                           22.3s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/h4/f0yhqb6d0rg8gtlft3shw5140000gn/T/flutter_tools.4Xwkjf/flutter_ios_build_temp_dir2m7ZnF/temporary_xcresult_bundle

    Failed to package /Users/leonardo/Development/flutter/git/resultadoloteria_flutter.
    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
    /Users/leonardo/Development/flutter/git/resultadoloteria_flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.5.99. (in target 'AppAuth' from project 'Pods')
    /Users/leonardo/Development/flutter/git/resultadoloteria_flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.5.99. (in target 'ReachabilitySwift' from project 'Pods')
    /Users/leonardo/Development/flutter/git/resultadoloteria_flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.5.99. (in target 'leveldb-library' from project 'Pods')

    Result bundle written to path:
        /var/folders/h4/f0yhqb6d0rg8gtlft3shw5140000gn/T/flutter_tools.4Xwkjf/flutter_ios_build_temp_dir2m7ZnF/temporary_xcresult_bundle

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

Xcode错误是(没有错误详细信息):

PhaseScriptExecution Run\ Script /Users/leonardo/Library/Developer/Xcode/DerivedData/Runner-arvdcpgzmyfuxqhgvygiyzfywxcj/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Script-9740EEB61CF901F6004384FC.sh (in target 'Runner' from project 'Runner')
    cd /Users/leonardo/Development/flutter/git/resultadoloteria_flutter/ios
    export ACTION\=build
    export AD_HOC_CODE_SIGNING_ALLOWED\=YES
    export ALLOW_TARGET_PLATFORM_SPECIALIZATION\=NO
    export ALTERNATE_GROUP\=staff
    export ALTERNATE_MODE\=u+w,go-w,a+rX
    export ALTERNATE_OWNER\=leonardo
    export ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES\=YES
    export ALWAYS_SEARCH_USER_PATHS\=NO
    export ALWAYS_USE_SEPARATE_HEADERMAPS\=NO
    export APPLE_INTERNAL_DEVELOPER_DIR\=/AppleInternal/Developer
    export APPLE_INTERNAL_DIR\=/AppleInternal
    export APPLE_INTERNAL_DOCUMENTATION_DIR\=/AppleInternal/Documentation

... A lot of export lines....

    export __CODE_SIGNING_ALLOWED_appletvos\=NO
    export __CODE_SIGNING_ALLOWED_iphoneos\=NO
    export __CODE_SIGNING_ALLOWED_watchos\=NO
    export arch\=undefined_arch
    export variant\=normal
    /bin/sh -c /Users/leonardo/Library/Developer/Xcode/DerivedData/Runner-arvdcpgzmyfuxqhgvygiyzfywxcj/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Script-9740EEB61CF901F6004384FC.sh

Failed to package /Users/leonardo/Development/flutter/git/resultadoloteria_flutter.
Command PhaseScriptExecution failed with a nonzero exit code

我已经尝试降级flutter(从3。3到3.0.5),重新安装xcode,吊销证书并重新安装,但什么都不起作用。
我目前的Flutter医生是:

[✓] Flutter (Channel stable, 3.0.5, on macOS 12.5.1 21G83 darwin-arm, locale es-419)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.70.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

更新:我发现了一些有用的东西,但Flutter团队说这不是一个选择:

github.com/flutter/flutter/issues/99387#issuecomment-1105467295

sqxo8psd

sqxo8psd1#

我觉得你应该这样做:
1.删除pubspec。锁定ios/Podfile。锁定文件
1.删除ios/Pods文件夹
1.执行flutter pub get
1.通过cd ios终端进入ios文件夹
1.执行arch -x86_64 pod install
1.立即运行应用程序该问题可能是由于Pod冲突。如果是这样的话,我上面写的方法一定行得通。

cl25kdpy

cl25kdpy2#

在我的情况下,我能够在模拟器中成功运行它,但在iOS的真实的设备上运行它时,我遇到了这个问题,我通过修改Build Active Architecture only解决了这个问题:是排除架构:pod目标和应用程序目标中的i386

相关问题