Flutter iOS在CodeMagic M1 Mac构建Release包时路径过长报错
解决Flutter iOS Release构建中路径过长(重复Runner.app嵌套)的问题
问题现象
手动添加缺失的ios/flutter/AppFrameworkInfo.plist后,Release构建出现Xcode报错:
Xcode build done. 70.9s Failed to build iOS app Error (Xcode): '/Users/builder/clone/build/ios/Release-iphoneos/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app' is longer than filepath buffer size (1025). Encountered error while building for device.
解决步骤
1. 修正AppFrameworkInfo.plist配置
从新Flutter项目复制的plist可能带有不匹配的配置,导致Xcode打包时无限嵌套Runner.app:
- 打开
ios/flutter/AppFrameworkInfo.plist,确保以下字段正确:CFBundleExecutable:值应为AppFrameworkCFBundleIdentifier:值应为$(PRODUCT_BUNDLE_IDENTIFIER).AppFramework(与项目Bundle ID对应)CFBundleName:值应为AppFrameworkCFBundlePackageType:值应为FMWK
2. 彻底清理构建缓存
- 执行Flutter清理命令:
flutter clean - 进入iOS目录,重新安装依赖:
cd ios pod deintegrate pod install cd .. - 打开Xcode,按下
Cmd+Shift+K清理构建文件夹,然后重启Xcode
3. 验证Xcode项目配置
- 打开Xcode的Runner target,进入
Build Settings:- 检查
Framework Search Paths,确保没有错误的嵌套路径 - 进入
Build Phases,查看Embed Frameworks,确认AppFramework.framework的引用路径正确,没有重复添加
- 检查
内容的提问来源于stack exchange,提问作者Ahmed Ali
相关产品推荐
相关产品推荐

