Skip to content

Xcode 11 Swift Packages incompatible with "flutter build" #44811

@LinusU

Description

@LinusU

We are trying to use a Swift package using the newly integrated Swift Package Manager in Xcode 11 in our iOS specific platform code. While it works as long as we build the app via Xcode, we cannot build or run the app using the flutter tool.

Steps to Reproduce

  1. Create a new Flutter app
  2. Open the Xcode project
  3. Select "File" -> "Swift Packages" -> "Add Package Dependency"
  4. Add any package, e.g. "https://github.com/doneservices/ApsEnvironment"
  5. Try and build the app: "flutter build ios"
  6. Observe below documented error

Target Platform: iOS
Target OS version/browser: iOS 13
Devices: iPhone 8, iPhone 11 Pro

command

flutter build ios

exception

ProcessException: ProcessException: Process "/usr/bin/xcodebuild" exited abnormally:
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
#0      runCheckedAsync (package:flutter_tools/src/base/process.dart:259:7)
<asynchronous suspension>
#1      XcodeProjectInterpreter.getInfo (package:flutter_tools/src/ios/xcodeproj.dart:270:36)
<asynchronous suspension>
#2      buildXcodeProject (package:flutter_tools/src/ios/mac.dart:279:70)
<asynchronous suspension>
#3      BuildIOSCommand.runCommand (package:flutter_tools/src/commands/build_ios.dart:84:43)
<asynchronous suspension>
#4      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:490:18)
#5      _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#6      _rootRunUnary (dart:async/zone.dart:1132:38)
#7      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#8      _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#9      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#10     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#11     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#12     Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:552:7)
#13     _rootRun (dart:async/zone.dart:1124:13)
#14     _CustomZone.run (dart:async/zone.dart:1021:19)
#15     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#16     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#17     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#18     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#19     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13)
#20     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173:5)

flutter doctor

[✓] Flutter (Channel stable, v1.9.1+hotfix.6, on Mac OS X 10.14.6 18G1012, locale en-SE)
    • Flutter version 1.9.1+hotfix.6 at /Users/linus/coding/flutter
    • Framework revision 68587a0916 (9 weeks ago), 2019-09-13 19:46:58 -0700
    • Engine revision b863200c37
    • Dart version 2.5.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
    • Android SDK at /Users/linus/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.1
    • ANDROID_HOME = /Users/linus/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.2.1, Build version 11B500
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 41.1.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

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

[✓] Connected device (2 available)
    • A10           • DIN7YS5DU4V4PNNJ          • android-arm • Android 7.0 (API 24)
    • Linus’ iPhone • 00008030-001135E63430802E • ios         • iOS 13.2

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: crashStack traces logged to the consolet: xcode"xcodebuild" on iOS and general Xcode project managementtoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions