Flutter升级后cloud_firestore包导致iOS构建失败
Hey there, let’s work through this frustrating build issue you’re facing after upgrading Flutter. When cloud_firestore breaks your iOS build but removing it fixes things, it’s almost always related to dependency conflicts, outdated caches, or misconfigured iOS project settings. Here are the step-by-step fixes that usually resolve this:
1. Full Cache & Pod Cleanup
Stale caches and outdated Pods are the #1 culprit here—let’s wipe them and start fresh:
- Navigate to your project’s iOS directory:
cd ios - Delete the Pod lock file and Pods folder:
rm Podfile.lock rm -rf Pods - Head back to the project root:
cd .. - Clear Flutter’s build cache:
flutter clean - Re-fetch your Dart dependencies:
flutter pub get - Reinstall Pods with repo updates (critical to pull the latest Firebase versions):
cd ios && pod install --repo-update
2. Verify Firebase Configuration File
Double-check that your GoogleService-Info.plist is set up correctly:
- Make sure it’s placed in the
ios/Runnerdirectory - Important: Add it to your Xcode project by right-clicking the Runner folder in Xcode and selecting "Add Files to Runner"—don’t just drag it into Finder, as this can cause hidden path issues.
3. Update Podfile Settings
Flutter upgrades sometimes require adjustments to your iOS Podfile:
- Open
ios/Podfileand ensure the platform version meets Firebase’s minimum requirement:platform :ios, '13.0' - If you’re using other Firebase plugins, add the static linkage flag for frameworks (this fixes many compatibility conflicts):
target 'Runner' do use_frameworks! :linkage => :static use_modular_headers! # ... rest of your Podfile code end
4. Sync Firebase Dependency Versions
Outdated or mismatched Firebase plugin versions can break builds:
- Run
flutter pub upgrade cloud_firestoreto pull the latest compatible version of the plugin - Check your
pubspec.yamlto ensure all Firebase plugins (likefirebase_core) are on versions that work with your upgraded Flutter SDK
5. Xcode Project Sanity Checks
Open your project in Xcode (use Runner.xcworkspace, not Runner.xcodeproj) and verify these settings:
- Go to Build Settings > Deployment Target and confirm it’s set to iOS 13.0 or higher
- Check Signing & Capabilities to ensure Cloud Firestore is listed (most plugins add this automatically, but it’s worth verifying)
If none of these steps work, try deleting and re-installing your Flutter SDK to ensure you have a clean, up-to-date environment.
内容的提问来源于stack exchange,提问作者Travis Baksh

