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

Flutter iOS项目执行flutter run时出现xcodebuild无法读取Runner.xcodeproj错误

Flutter iOS构建报错修复方案

报错信息:
ProcessException: Process exited abnormally: Command line invocation: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -list
User defaults from command line: IDEPackageSupportUseBuiltinSCM = YES
xcodebuild: error: Unable to read project 'Runner.xcodeproj'.
Reason: Project /Users/Zer01onE/Desktop/flutter/deliveryapp/ios/Runner.xcodeproj cannot be opened because it is missing its project.pbxproj file.
Command: xcrun xcodebuild -list

核心原因

project.pbxproj是Xcode项目的核心配置文件,该报错触发的核心原因是配置文件丢失、损坏,或Flutter/Xcode缓存异常导致文件无法被正常识别。

修复步骤

  1. 校验配置文件是否存在
    进入项目ios目录执行命令:

    ls Runner.xcodeproj/
    

    若输出中没有project.pbxproj文件,优先从Git等版本控制系统中恢复该文件;无备份则走后续重建步骤。

  2. 全量清理项目缓存
    在项目根目录依次执行以下命令:

    • 清理Flutter缓存:flutter clean
    • 删除ios目录下残留的Pod相关文件与工作空间:
      rm -rf ios/Podfile ios/Podfile.lock ios/Pods ios/Runner.xcworkspace pubspec.lock
      
    • 重新拉取Dart依赖:flutter pub get
  3. 若确认project.pbxproj文件丢失无备份,执行命令重建iOS平台配置:

    flutter create .
    

    该命令只会补全缺失的平台原生配置,不会覆盖已编写的业务代码。

  4. 重新安装Pod依赖
    进入ios目录依次执行:

    • 解除现有Pod绑定:pod deintegrate
    • 安装依赖:pod install --allow-root(普通用户可省略--allow-root参数)
  5. 校验Xcode命令行工具配置
    执行命令查看当前命令行工具路径:

    xcode-select -p
    

    若输出不是/Applications/Xcode.app/Contents/Developer,执行以下命令切换:

    sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
    
  6. 验证修复结果
    在ios目录下执行xcodebuild -list,无报错即可回到项目根目录执行flutter run启动项目。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.29 06:15:03