Flutter 3.13.4 iOS构建报错:no such module 'Firebase'
Flutter 3.13.4 iOS构建报错“no such module 'Firebase'”终端修复方案
问题背景
升级Flutter到3.13.4版本后,iOS构建触发「no such module 'Firebase'」错误,同时伴随「Using bridging headers with module interfaces is unsupported」编译提示,原有清理构建命令已失效,需通过纯终端操作完成修复,无需进入Xcode配置。
终端修复步骤
1. 基础项目清理
执行以下命令清理项目缓存与冗余依赖文件:
flutter clean rm -rf ios/Pods ios/Podfile.lock pubspec.lock flutter pub get
2. 修复Podfile依赖问题(终端自动调整)
你的Podfile存在多Target重复引入Firebase相关依赖、源地址不稳定的问题,通过终端命令快速修复:
# 将Podfile的依赖源替换为CDN,提升拉取稳定性 sed -i '' 's/source '\''https:\/\/github.com\/CocoaPods\/Specs.git'\''/source '\''https:\/\/cdn.cocoapods.org\/'\''/' ios/Podfile # 移除Runner Target中多余的GoogleUtilities依赖(Flutter Firebase插件已自动引入该依赖) sed -i '' '/pod '\''GoogleUtilities'\''/d' ios/Podfile
3. 重新安装Pods依赖
进入iOS目录,执行Pod清理与重新安装:
cd ios pod deintegrate pod install --repo-update --verbose
4. 清理Xcode缓存(可选,若上述步骤无效)
rm -rf ~/Library/Developer/Xcode/DerivedData
5. 验证构建
回到项目根目录,执行构建命令验证修复效果:
flutter run ios
关键问题说明
- 报错中「Using bridging headers with module interfaces is unsupported」提示,源于Flutter 3.13.x对Swift模块接口的处理更严格,多Target重复依赖会导致模块解析冲突;
- 原有清理命令未解决Podfile中的依赖重复问题,因此失效;
- 替换CocoaPods源为CDN可避免GitHub源的访问不稳定问题,提升依赖拉取成功率。
内容的提问来源于stack exchange,提问作者Rageh Azzazy
相关产品推荐
相关产品推荐

