Build error when adding a dependency using Swift Package Manager in Xcode for a Flutter project

6,429

I think I might have the fix for you.

Please close your workspace in XCode, and go back and open the .xcodeproj file INSTEAD of the .xcworkspace file.

(/yourApp/ios/Runner.xcodeproj most likely)

When the project is open, in XCode menu bar click File -> Project Settings -> Advanced.

Change the option from LEGACY to XCODE DEFAULT.

Now open the .xcworkspace again and it should work!

Share:
6,429
matteoh
Author by

matteoh

Updated on December 27, 2022

Comments

  • matteoh
    matteoh over 1 year

    In my Flutter project, I need to add dependencies on the native iOS part of my project.

    For that, I use Swift Package Manager.

    But each time I try to run my app, after adding a dependency, I get the following build error:

    ProcessException: Process exited abnormally:
    Command line invocation:
        /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -list
    
    
    xcodebuild: error: Could not resolve package dependencies:
      Packages are not supported when using legacy build locations, but the current project has them enabled.
      Command: /usr/bin/xcodebuild -list
    

    More details here.

    Since I'm new to iOS development, how can I add dependencies in Xcode so my Flutter app works?

    Thanks.

  • matteoh
    matteoh about 3 years
    Yup, I got the same answer on the Flutter Github ;) Thanks!
  • Eray Hamurlu
    Eray Hamurlu almost 3 years
    I got this error after adding facebook sdk .and fixed my issue