Skip to content

Consider adding DerivedData and org.swift.swiftpm to flutter clean command to fix SPM build #183226

Closed

Description

@Gustl22

Use case

Recently we upgraded from firebase_core 4.4.0 to 4.5.0. And we got the error on macos:

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

I tried everything:

  • flutter clean
  • removing build folder
  • removing temporary folders in ios
  • repair flutter packages cache
  • Reset package caches in XCode

Seemingly nothing worked.

Others had this problem, too, and I suspect the problem will appear on every firebase_core upgrade and their according packages:
firebase/flutterfire#17980
firebase/flutterfire#17962

I haven't tried to reproduce, but I will later (as its probably hard to reproduce), if it is feasable to add.

Proposal

I propose to add these command to the flutter clean command. So package maintainers don't need to bother searching how to resolve build issues:

rm -rf ~/Library/Developer/Xcode/DerivedData/Runner-*
rm -rf ~/Library/Caches/org.swift.swiftpm

help: 'When cleaning Xcode schemes, clean only the specified scheme.',

Sorry for the vague feature request. I just want to write it down to help others and probably get more cases, where this can be useful, as I suspect most of people just do not write an issue, and go on after finding this:
firebase/flutterfire#17962 (comment)

Also by far not everyone uses SPM yet, so I suspect there will be more which are faced with this issue in the future.
The reason might also have to do how Firebase handles its dependencies, but I find it reasonable to have a way to get rid of all potentional pitfalls, which hinders on building successfully.

Edit: this happened on an ios build

Activity

  1. changed the title [-]Consider adding DerivedData and `org.swift.swiftpm` to clean command to fix SPM build[/-] [+]Consider adding DerivedData and `org.swift.swiftpm` to `flutter clean` command to fix SPM build[/+] on Mar 4, 2026
  2. added
    in triagePresently being triaged by the triage team
    c: proposalA detailed proposal for a change to Flutter
    team-macosOwned by the macOS platform team
    toolAffects the "flutter" command-line tool. See also t: labels.
    fyi-iosFor the attention of iOS platform team
    on Mar 5, 2026
  3. mbcorona commented on Mar 5, 2026

    @mbcorona
    Member

    Thanks for the proposal, @Gustl22.

    I am routing this to team-macos (with an FYI to iOS) to evaluate whether clearing these Xcode and SwiftPM caches should be integrated into the flutter clean command.

  4. removed
    in triagePresently being triaged by the triage team
    on Mar 5, 2026
  5. arnoutvandervorst commented on Mar 6, 2026

    @arnoutvandervorst

    Same for me but also in iOS builds, breaks every time on a firebase_core upgrade.

  6. Gustl22 commented on Mar 6, 2026

    @Gustl22
    ContributorAuthor

    @arnoutvandervorst thank you for confirming. Can you consider to give the issue a thumbs up?

    The Flutter team prioritizes issues in part based on the number of +1 (thumbs

  7. arnoutvandervorst commented on Mar 6, 2026

    @arnoutvandervorst

    Also just confirmed that this is the solution in my case. Using flutter clean, cache clean is not enough.

  8. added
    team-iosOwned by iOS platform team
    and removed
    team-macosOwned by the macOS platform team
    fyi-iosFor the attention of iOS platform team
    on Mar 11, 2026
  9. added
    P1High-priority issues at the top of the work list
    triaged-iosTriaged by iOS platform team
    on Mar 12, 2026
  10. vashworth commented on Mar 13, 2026

    @vashworth
    Contributor

    If anyone is able to reproduce this, please provide reproduction steps. I have been unable to reproduce

  11. vashworth commented on Mar 16, 2026

    @vashworth
    Contributor

    Okay I was able to reproduce this:

    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
  12. vashworth commented on Mar 16, 2026

    @vashworth
    Contributor

    @Gustl22 Thanks for reporting this. I was able to get it to reproduce. I don't think the solution here is to delete the SwiftPM cache since SwiftPM packages are very slow to download and fetch. I think the solution required here is getting SwiftPM to re-cache the Package.swift manifests when the plugin version changes, which we can do by manipulating the path in the symlink. I've got a PR out to fix it

  13. Gustl22 commented on Mar 16, 2026

    @Gustl22
    ContributorAuthor

    @vashworth thank you for investigation and providing a possible fix! Even better, I am happy with any solution, which works out for you. The more implicit the better (without the user need to do anything).

  14. github-actions commented on Apr 21, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  15. locked as resolved and limited conversation to collaborators on Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listc: proposalA detailed proposal for a change to Flutterplatform-macosBuilding on or for macOS specificallyteam-iosOwned by iOS platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-iosTriaged by iOS platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions