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

Codemagic中Flutter iOS构建失败:CocoaPods无法找到兼容FBSDKCoreKit版本

Flutter Codemagic iOS构建失败:CocoaPods依赖冲突解决

问题分析

本地可正常构建Android和iOS版本,但Codemagic上iOS构建失败,核心报错为CocoaPods依赖版本冲突:

[!] CocoaPods could not find compatible versions for pod "FBSDKCoreKit":
In snapshot (Podfile.lock):
FBSDKCoreKit (= 14.1.0)

In Podfile:
flutter_facebook_auth (from .symlinks/plugins/flutter_facebook_auth/ios) was resolved to 4.3.0, which depends on
FBSDKCoreKit (~> 13)

原因是Podfile.lock中锁定的FBSDKCoreKit版本为14.1.0,但flutter_facebook_auth 4.3.0仅兼容13.x版本的FBSDKCoreKit。本地构建正常是因为存在依赖缓存,而Codemagic是干净构建环境,直接按锁文件和Podfile的依赖要求解析,导致版本冲突。

解决步骤

1. 同步本地依赖状态到代码仓库

  • 本地删除ios/Podfile.lock文件
  • 执行命令清理Flutter缓存:flutter clean
  • 重新获取项目依赖:flutter pub get
  • 进入ios目录,更新CocoaPods仓库并安装依赖:pod install --repo-update
  • 将更新后的Podfile.lock提交到代码仓库,重新触发Codemagic构建

2. 强制指定兼容版本(不升级插件)

如果暂时不想升级flutter_facebook_auth,可以在ios/Podfile中添加强制版本约束:

# 在Podfile末尾添加
pod 'FBSDKCoreKit', '~>13.0'

执行pod install --repo-update后,提交修改后的Podfile和Podfile.lock到仓库,重新发起构建。

3. 升级flutter_facebook_auth插件

查看flutter_facebook_auth的最新稳定版,在项目的pubspec.yaml中升级插件版本(选择支持FBSDKCoreKit 14.x的版本):

dependencies:
  flutter_facebook_auth: ^latest_stable_version

执行flutter pub get,进入ios目录执行pod install --repo-update,提交更新后的文件到仓库,重新触发Codemagic构建。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.21 19:00:03