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

重新克隆Flutter项目后iOS模拟器编译报错:'grpcpp/support/byte_buffer.h'未找到

Fix for 'grpcpp/support/byte_buffer.h' file not found in Flutter iOS Build

Since you’ve already tried common solutions from Google, let’s dive into targeted fixes to resolve this build error:

  • Wipe Pods and Build Cache Entirely
    Residual cache from your old setup is often the culprit. Run these commands in your project’s ios folder:

    pod deintegrate
    rm -rf Podfile.lock Pods
    rm -rf ~/Library/Caches/CocoaPods
    rm -rf ~/Library/Developer/Xcode/DerivedData
    pod install
    

    Head back to your project root, run flutter clean, then try flutter run again.

  • Align Firebase Package Versions
    The error links to FirebaseFirestore’s dependency on gRPC. Double-check your pubspec.yaml and ios/Podfile to ensure firebase_core and cloud_firestore are on compatible, up-to-date versions. Run flutter pub upgrade to sync dependencies, then re-run pod install.

  • Explicitly Pin gRPC Version
    Force a compatible gRPC version by adding this line to your ios/Podfile (before the target 'Runner' do block):

    pod 'gRPC-C++', '~> 1.50.0' # Adjust to match your Firestore version's requirements
    

    Run pod install afterward to pull the correct library.

  • Validate Xcode Header Paths
    Open your iOS project in Xcode, navigate to the Runner target’s Build Settings, search for Header Search Paths, and confirm $(PODS_ROOT)/gRPC-C++/include is listed (set to recursive). This ensures Xcode can find the missing gRPC headers.

  • Fresh Clone with Clean Setup
    If all else fails, clone the repo into a brand new directory—don’t carry over any old config files. Run flutter pub get, then cd ios && pod install, before attempting to build. This eliminates any leftover artifacts from your previous Mac setup.


Original Build Log:
Launching lib/main.dart on iPhone 12 in debug mode...
lib/main.dart:1
Xcode build done. 8,8s
Failed to build iOS app
Error output from Xcode build:
↳ ** BUILD FAILED **
Xcode's output:
↳ In file included from /Applications/MAMP/htdocs/capido/ios/Pods/FirebaseFirestore/Firestore/core/src/nanopb/writer.cc:17:
/Applications/MAMP/htdocs/capido/ios/Pods/FirebaseFirestore/Firestore/core/src/nanopb/writer.h:28:10: fatal error: 'grpcpp/support/byte_buffer.h' file not found
#include "grpcpp/support/byte_buffer.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 12.
Exited (sigterm)

内容的提问来源于stack exchange,提问作者Erwin Oudshoorn

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.11 07:55:41