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

Flutter iOS打包IPA遇Xcode重复命令错误求助

Flutter打包IPA时Firestore Bundle冲突的修复思路

核心原因

该错误源于Xcode构建过程中,多个任务尝试生成并输出同一个FirebaseFirestore_Privacy.bundle文件,通常是Firestore预编译SDK与其他Firebase依赖的资源重复导致。


具体修复步骤

1. 清理构建缓存与重新安装依赖

  • 执行Flutter缓存清理:
    flutter clean
    
  • 手动删除Xcode衍生数据目录(即错误提示中的路径):
    rm -rf /Users/antonio/Library/Developer/Xcode/DerivedData/Runner-edmltyztwaxqqcevfshktmkpdgia
    
  • 进入iOS目录重新处理Pods:
    cd ios
    pod deintegrate
    pod install
    

2. 统一Firebase SDK版本

在Podfile中指定所有Firebase组件的统一版本,避免版本不一致引发的资源冲突:

  1. 在Podfile顶部添加版本常量:
    $FirebaseSDKVersion = '10.24.0'
    
  2. 修改其他Firebase依赖的引入方式:
    pod 'FirebaseAuth', $FirebaseSDKVersion
    pod 'FirebaseStorage', $FirebaseSDKVersion
    pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.24.0'
    
  3. 重新执行pod install。

3. 检查Xcode项目的资源配置

  • 打开iOS目录下的Runner.xcworkspace
  • 选中Runner目标,进入Build Phases -> Copy Bundle Resources
  • 查看是否存在重复的FirebaseFirestore_Privacy.bundle条目,若有则删除其中一个
  • 同时检查Link Binary With Libraries,确保无重复引用的Firestore相关库

4. 替换Firestore为官方Pod(备选方案)

如果预编译SDK仍存在冲突,尝试改用官方FirebaseFirestore Pod:

  1. 注释掉当前的预编译引入,改为:
    pod 'FirebaseFirestore', '10.24.0'
    
  2. 执行pod install重新安装(注意:官方Pod编译时间会更长)

5. 验证Flutter插件兼容性

  • 检查pubspec.yaml中Firebase Flutter插件(cloud_firestore、firebase_auth、firebase_storage)的版本,确保其支持iOS端Firebase SDK 10.24.0
  • 调整插件版本后执行flutter pub get,再重新处理iOS端Pods

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.25 06:12:40