Repository navigation
Consider adding DerivedData and org.swift.swiftpm to flutter clean command to fix SPM build #183226
Description
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 cachesin 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
[-]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[/+]mbcorona commentedon Mar 5, 2026
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.
arnoutvandervorst commentedon Mar 6, 2026
Same for me but also in iOS builds, breaks every time on a firebase_core upgrade.
Gustl22 commentedon Mar 6, 2026
@arnoutvandervorst thank you for confirming. Can you consider to give the issue a thumbs up?
flutter/docs/contributing/issue_hygiene/README.md
Line 25 in 7a95d24
arnoutvandervorst commentedon Mar 6, 2026
Also just confirmed that this is the solution in my case. Using flutter clean, cache clean is not enough.
vashworth commentedon Mar 13, 2026
If anyone is able to reproduce this, please provide reproduction steps. I have been unable to reproduce
vashworth commentedon Mar 16, 2026
Okay I was able to reproduce this:
flutter config --enable-swift-package-managerflutter create my_app && cd my_appflutter pub add firebase_core:4.4.0open ios/Runner.xcworkspaceand update minimum version for iOS to 15.0flutter build iosflutter pub add firebase_core:4.5.0flutter pub add firebase_analyticsflutter build iosvashworth commentedon Mar 16, 2026
@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
Gustl22 commentedon Mar 16, 2026
@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).
Add plugin version to SwiftPM package symlink directory (#183668)
Add plugin version to SwiftPM package symlink directory (flutter#183668)
github-actions commentedon Apr 21, 2026
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 -vand a minimal reproduction of the issue.Add plugin version to SwiftPM package symlink directory (#183668)