Skip to content

[all]: Firebase Flutter plugins have conflicting version when updating while using Swift Package Manager #18129

@vashworth

Description

@vashworth

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

No response

Which platforms are affected?

iOS, macOS

Description

When updating a Firebase plugin while using SwiftPM you may see an error like this:

Failed to resolve dependencies Dependencies could not be resolved because 'firebase_core' depends on 'flutterfire' 4.3.0-firebase-core-swift and 'firebase_analytics' depends on 'flutterfire' 4.4.0-firebase-core-swift.

This has been reported multiple times:

#17980
#17962
#18088
#18082
#18106
#18114
#17962
#16903

The cause is that the Firebase plugins use a variable to set the required version of it's remote SwiftPM dependencies:

dependencies: [
.package(url: "https://github.com/firebase/firebase-ios-sdk", from: firebase_sdk_version),
.package(url: "https://github.com/firebase/flutterfire", exact: shared_spm_version),
],

SwiftPM calculates the version the first time it reads the manifest and then caches it. It does not re-run the swift code again unless the Package.swift changes.

The versions should be hard-coded rather than calculated.

Reproducing the issue

  1. flutter config --enable-swift-package-manager
  2. flutter create my_app && cd my_app
  3. flutter pub add firebase_core:4.4.0
  4. open ios/Runner.xcworkspace and update minimum version for iOS to 15.0
  5. flutter build ios
  6. flutter pub add firebase_core:4.5.0
  7. flutter pub add firebase_analytics
  8. flutter build ios

Firebase Core version

4.4.0/4.5.0

Flutter Version

3.43.0-1.0.pre-132

Relevant Log Output

Flutter dependencies

Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.

Additional context and comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs AttentionThis issue needs maintainer attention.type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions