8

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?

Opgesy
  • 103
  • 1
  • 1
  • 7

3 Answers3

9

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.

Ashutosh singh
  • 820
  • 6
  • 17
  • 1
    This answer is good way to start. For me it wasn't a complete fix. Migrate for Android is needed also: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects – nja Apr 06 '22 at 10:53
  • flutter version upgrade solved my issue. – Vipin Krishna Apr 24 '23 at 14:03
3

I spent way too much time on this issue.

For me the problem was related to the Flutter cache and running the following command resolved the issue:

flutter pub cache repair

The solution made sense to me when I noticed a plugin trying to reference [flutter-sdk-path]/flutter/packages/flutter/lib/screens.dart--which did not exist in my Flutter SDK.

Ref: Update flutter dependencies in /.pub-cache

Guys, sometimes it better to just GO TO SLEEP! It helps a great deal to have fresh eyes looking at a problem.

Je Suis Alrick
  • 3,404
  • 2
  • 16
  • 23
-1

if you have Podfile in iOS folder

Go to iOS folder of the project

run

flutter clean

and

flutter pub get

and

pod update

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). Especially information about what those commands do, so others won't run commands without thinking about them. Additionally `pod update` might not always be the right tool, so explaining why use `pod update` instead of `pod install` would be beneficial. – Tadeas Kriz Jan 26 '23 at 03:58