iosxcodeflutter

Flutter: error Xcode: command PhaseScriptExecution failed with a nonzero exit code


I tried to run flutter after updating to the newest stable version

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


Xcodes output:
↳
    Writing result bundle at path:
        /var/folders/56/fc0b38hx7dv7ldxkbs9flh_m0000gn/T/flutter_tools.sDq2W5/flutter_ios_build_temp_dirGNvLvF/temporary_xcresult_bundle

    /usr/local/Caskroom/flutter/2.5.2/flutter/.pub-cache/hosted/pub.dartlang.org/platform-3.0.0/lib/src/interface/local_platform.dart:46:19: Error: Member not
    found: 'packageRoot'.
          io.Platform.packageRoot; // ignore: deprecated_member_use
                      ^^^^^^^^^^^
    
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in parallel

    Result bundle written to path:
        /var/folders/56/fc0b38hx7dv7ldxkbs9flh_m0000gn/T/flutter_tools.sDq2W5/flutter_ios_build_temp_dirGNvLvF/temporary_xcresult_bundle


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

I've tried flutter clean and flutter pub get but that isn't the fix. Anyone any idea how to fix this?


Solution

  • As i see you are currently using flutter 2.5.2 which is newest,So Update you flutter SDK by running command

    flutter upgrade
    

    Then Upgrade the current package's dependencies to latest versions by running command

    flutter pub upgrade
    

    Go to iOS folder of the project run

    pod init
    

    and

    pod install
    

    I hope this solution solve your problem.

    Please up the vote if this answer help you.