简体   繁体   中英

cannot run Flutter application on iOS simulator / Command PhaseScriptExecution failed with a nonzero exit code

enter image description here enter image description here

Addition is below

I make Flutter app. and then recently it happens cannot to run appication on iOS simulater. I guess the reason is Xcode upgrade but don't know well.

do you have any idea to help it? thank you.

// environment //

  • PC:2021 Macbook air (apple silicon)
  • MacOS:12.0.1 - recently updated
  • Visual Studio code:1.62.3
  • Xcode:13.0 -recently updated
  • Flutter:2.5.3

// done //

  • restart PC & Xcode & Vscode
  • reflessh keychain
  • List item

delete DerivedData

// flutter doctor //


flutter doctor -v
[✓] Flutter (Channel stable, 2.5.3, on macOS 12.0.1 21A559 darwin-arm, locale ja-JP)
    • Flutter version 2.5.3 at /Users/osanaidaisuke/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (7 weeks ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/osanaidaisuke/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 13.0, Build version 13A233
    • CocoaPods version 1.10.1

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

[✓] Android Studio (version 2020.3)
    • 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.10+0-b96-7249189)

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

[✓] Connected device (2 available)
    • iPhone 12 Pro (mobile) • B2A1F8F1-D8D0-41D4-B58F-B3AC18E0E3CE • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 96.0.4664.55

• No issues found!

// debug console //


Launching lib/main.dart on iPhone 12 Pro in debug mode...
lib/main.dart:1
Xcode build done.                                            3.8s
Failed to build iOS app
Error output from Xcode build:
↳
    --- xcodebuild: WARNING: Using the first of multiple matching destinations:
    { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
    { platform:iOS Simulator, id:E4530DD9-3EEB-4DFF-895E-2284A8BE131C, OS:15.0, name:iPad (9th generation) }
    { platform:iOS Simulator, id:C9AEED53-CAAE-4357-9507-508EA93199C8, OS:15.0, name:iPad Air (4th generation) }
    { platform:iOS Simulator, id:BE2B5D9F-C78E-4BE6-8720-66D6B37A7DBB, OS:15.0, name:iPad Pro (9.7-inch) }
    { platform:iOS Simulator, id:FA89C5C9-39C1-4F00-91CA-45924F0484C3, OS:15.0, name:iPad Pro (11-inch) (3rd generation) }
    { platform:iOS Simulator, id:2A37CCE9-6BA7-4BB9-9430-DB5EBCBE8D3E, OS:15.0, name:iPad Pro (12.9-inch) (5th generation) }
    { platform:iOS Simulator, id:A641FC6E-451B-43CD-97AE-2427F4E71FC6, OS:15.0, name:iPad mini (6th generation) }
    { platform:iOS Simulator, id:01C67389-E045-469F-88AF-4CE2980CE0B0, OS:15.0, name:iPhone 8 }
    { platform:iOS Simulator, id:D14130F2-B8BE-4FC2-8F99-537686236900, OS:15.0, name:iPhone 8 Plus }
    { platform:iOS Simulator, id:6DE2DBDC-6BB8-41FF-A7EA-122E06ED3D09, OS:15.0, name:iPhone 11 }
    { platform:iOS Simulator, id:7FFC4095-7D08-4353-81CD-957F563FAF6A, OS:15.0, name:iPhone 11 Pro }
    { platform:iOS Simulator, id:D397D581-E8C0-4EC4-BFE5-F05161D28A32, OS:15.0, name:iPhone 11 Pro Max }
    { platform:iOS Simulator, id:055C8666-A3D5-4AF3-B52C-1F67909F3876, OS:15.0, name:iPhone 12 }
    { platform:iOS Simulator, id:B2A1F8F1-D8D0-41D4-B58F-B3AC18E0E3CE, OS:15.0, name:iPhone 12 Pro }
    { platform:iOS Simulator, id:EEBEE112-736C-4D00-AEDC-7E4874390DB5, OS:15.0, name:iPhone 12 Pro Max }
    { platform:iOS Simulator, id:CB3FC6AE-A5A7-4973-A758-8D86ABAD2CEE, OS:15.0, name:iPhone 12 mini }
    { platform:iOS Simulator, id:659B04AA-DF4B-405E-B926-4FED18271CDD, OS:15.0, name:iPhone 13 }
    { platform:iOS Simulator, id:DFF4E533-9009-43D9-B905-7CC12C765C4E, OS:15.0, name:iPhone 13 Pro }
    { platform:iOS Simulator, id:AF7C323B-3BF0-4BAB-9F6B-1C7DFA62DB41, OS:15.0, name:iPhone 13 Pro Max }
    { platform:iOS Simulator, id:37DEFCE1-2E9E-42BB-91FE-93D0C7C92203, OS:15.0, name:iPhone 13 mini }
    { platform:iOS Simulator, id:55EA657F-A586-4634-95D7-75B26B73DFC4, OS:15.0, name:iPhone SE (2nd generation) }
    { platform:iOS Simulator, id:ACA87D06-CF69-490F-9DE7-12989F10CB62, OS:15.0, name:iPod touch (7th generation) }
    { platform:macOS, arch:arm64, variant:Designed for [iPad,iPhone], id:00008103-0003452226EA001E }
    { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
    ** BUILD FAILED **
Xcode's output:
↳
    Failed to package /Users/osanaidaisuke/code/project-name/listview.
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning
    note: Build preparation complete

addition

Every project file don't have Podsfile. Is this normal? And I could not install cocoapods.

/ sudo gem install cocoapods //

Password:
Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
        ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20211205-49831-16satjc.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
        --with-ffi_c-dir
        --without-ffi_c-dir
        --with-ffi_c-include
        --without-ffi_c-include=${ffi_c-dir}/include
        --with-ffi_c-lib
        --without-ffi_c-lib=${ffi_c-dir}/lib
        --enable-system-libffi
        --disable-system-libffi
        --with-libffi-config
        --without-libffi-config
        --with-pkg-config
        --without-pkg-config
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:546:in `block in try_link0'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tmpdir.rb:93:in `mktmpdir'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:543:in `try_link0'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:672:in `try_ldflags'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1832:in `pkg_config'
        from extconf.rb:9:in `system_libffi_usable?'
        from extconf.rb:42:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-21/2.6.0/ffi-1.15.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-21/2.6.0/ffi-1.15.4/gem_make.out

same case, "failed to package" https://github.com/flutter/flutter/issues/94692

possible solution

base on the answer: Command PhaseScriptExecution failed with a nonzero exit code while trying to add Flutter to iOS app

confirm that the "check & uncheck trick" help (with later "but"): 1 uncheck all then build, failed 2 check all (2) xcode_backend.sh & build, success

make the build & install success, but not run

many error log message states that the firebase failed started

FIXED, for my case is file permission problem, with flutter admin helped. https://github.com/flutter/flutter/issues/94692

but the root cause i think that is the error prompt is not obvious, you may take a look at the investigation steps to see why, and you may find yours solutions

Try to update pods, go to your ios folder, run ' pod deintegrate ' and then run 'pod install'. if this not helps then run 'pod update' or 'pod repo update'. try to find which package is giving issues, and changes thier versions.

This problem was resolved by upgrading Flutter --version from 2.5.3 to 2.8.1.

Source URL: https://minpro.net/your-flutter-checkout-has-local-changes-that-would-be-erased-by-upgrading

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