Flutter升级后CocoaPods无法找到兼容的Firebase/CoreOnly版本
解决Flutter升级后Firebase CocoaPods依赖冲突问题
方案1:强制统一Firebase iOS版本
在iOS目录的Podfile中锁定Firebase SDK版本,确保所有Firebase相关组件使用同一兼容版本:
- 打开
ios/Podfile,在target 'Runner' do代码块上方添加:
$FirebaseSDKVersion = '10.18.0'
- 保存文件后执行以下命令:
cd ios pod deintegrate rm Podfile.lock pod install --repo-update
方案2:同步Flutter Firebase插件版本
确保pubspec.yaml中所有Firebase插件版本相互兼容:
- 打开
pubspec.yaml,将所有firebase_*插件(如firebase_core、firebase_auth)更新为匹配的版本,示例:
firebase_core: ^2.24.2 firebase_auth: ^4.16.0
- 执行依赖更新命令:
flutter pub upgrade cd ios pod deintegrate rm Podfile.lock pod install
方案3:彻底清理缓存
如果常规清理无效,尝试清空Flutter和CocoaPods的所有缓存:
- 清理Flutter缓存:
flutter clean flutter pub get
- 清理CocoaPods本地缓存:
cd ios pod cache clean --all pod deintegrate rm Podfile.lock pod install --repo-update
方案4:检查Flutter SDK兼容性
确认当前Flutter SDK版本与firebase_auth 4.16.0的适配性:
- 查看当前Flutter版本:
flutter --version
- 若版本过低,切换到稳定版并升级:
flutter channel stable flutter upgrade
完成后重新执行依赖安装流程。
内容的提问来源于stack exchange,提问作者Ethan
相关产品推荐
相关产品推荐

