Flutter项目本地构建正常,但Xcode Cloud持续构建失败
问题重现
本地iOS模拟器可正常构建运行Flutter项目,但提交至GitHub后,Xcode Cloud构建抛出以下错误:
Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-resources-Release-input-files.xcfilelist'
could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig' in search paths
Release.xcconfig:4could not find included file 'Generated.xcconfig' in search paths
Release.xcconfig:2could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig' in search paths
Release.xcconfig:3Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Release-input-files.xcfilelist'
Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-resources-Release-output-files.xcfilelist'
Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Release-output-files.xcfilelist'
已尝试添加CocoaPods安装脚本、更新脚本及官方文档中的Post-clone脚本,均未解决问题。
解决步骤
1. 修正Release.xcconfig路径引用
打开ios/Release.xcconfig文件,检查并修正以下路径:
- 将第2行的
#include "Generated.xcconfig"改为:#include "Flutter/Generated.xcconfig" - 确认Pods相关xcconfig的引用路径正确(确保是相对于iOS目录的相对路径):
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"
2. 配置正确的Xcode Cloud Post-clone脚本
在Xcode Cloud Workflow的Post-clone阶段添加以下脚本,确保依赖安装流程完整:
# 安装Stable版本Flutter(若环境未预装) git clone https://github.com/flutter/flutter.git -b stable $HOME/flutter export PATH="$HOME/flutter/bin:$PATH" # 安装Flutter依赖 flutter pub get # 安装与本地一致的CocoaPods版本(替换为你使用的版本号) sudo gem install cocoapods -v 1.12.1 # 进入iOS目录并安装Pods依赖 cd ios pod install --repo-update
3. 检查Xcode Cloud Workflow配置
- 确保Workflow中选择的是Runner.xcworkspace而非
Runner.xcodeproj - 确认Build Scheme设置为
Runner (Release),匹配你的构建目标
4. 本地验证文件生成
在本地执行以下命令,确认必要文件已生成,避免因.gitignore误删导致的问题:
flutter pub get cd ios pod install
检查以下路径是否存在对应文件:
ios/Flutter/Generated.xcconfigios/Pods/Target Support Files/Pods-Runner/*.xcconfigios/Pods/Target Support Files/Pods-Runner/*.xcfilelist
内容的提问来源于stack exchange,提问作者Zamin Shaikh

