You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

添加firebase_in_app_messaging后Pod Install失败问题求助

解决Flutter项目Pod Install失败的方案

问题核心

项目的Podfile.lock文件锁定了Firebase/Database版本为10.2.0,但当前依赖的firebase_database: ^10.3.5需要Firebase/Database 10.18.0,版本不兼容导致安装失败。

解决步骤

1. 更新CocoaPods仓库

先更新本地CocoaPods源,确保能获取到最新依赖版本:

pod repo update

或者直接在安装时强制更新源:

pod install --repo-update

2. 清理旧锁定文件与缓存

如果第一步无效,手动清理旧的依赖缓存和锁定信息:

  • 进入项目的ios目录:
cd ios
  • 删除Podfile.lock文件:
rm Podfile.lock
  • 删除Pods文件夹:
rm -rf Pods
  • 清理CocoaPods全局缓存:
pod cache clean --all

3. 重新执行Pod安装

完成清理后,重新执行安装命令:

pod install

4. 统一Firebase依赖版本(可选)

确保所有Firebase相关Flutter依赖版本兼容,可尝试升级到最新兼容版本,修改pubspec.yaml:

firebase_core: ^2.24.2
firebase_messaging: ^14.7.10
firebase_in_app_messaging: ^0.7.4+6
firebase_database: ^10.4.0
firebase_core_platform_interface: ^5.0.0

执行Flutter依赖更新:

flutter pub get

再回到ios目录重新执行pod install。

5. 版本兼容性验证

你的Xcode版本为14.2,Firebase SDK 10.18.0支持Xcode 14.1及以上版本,版本兼容无需额外升级Xcode。

内容的提问来源于stack exchange,提问作者Subair K

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.05 18:20:03