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

Flutter环境下pod install卡在gRPC-Core 1.50.1问题求助

解决Flutter中pod install卡在gRPC-Core (1.50.1)的问题

方案1:彻底清理CocoaPods缓存与项目依赖

  • 进入iOS目录:cd ios
  • 彻底移除现有Pods依赖:pod deintegrate
  • 删除Podfile.lock和Pods文件夹:rm -rf Podfile.lock Pods
  • 清理CocoaPods全局缓存:pod cache clean --all
  • 重新执行安装:pod install --verbose(--verbose可查看详细日志,确认是真卡顿还是在编译)

方案2:强制调整gRPC-Core的编译配置

如果方案1无效,说明gRPC-Core 1.50.1的源码编译对iOS11.0支持存在兼容问题,可通过脚本强制修正:

  1. 打开iOS目录下的Podfile,在文件末尾添加如下post_install脚本:
post_install do |installer|
  installer.pods_project.targets.each do |target|
    # 针对gRPC核心组件调整编译参数
    if ['gRPC-Core', 'gRPC-C++'].include?(target.name)
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
        config.build_settings['ENABLE_BITCODE'] = 'NO'
        config.build_settings['ARCHS'] = 'arm64 x86_64'
      end
    end
    flutter_additional_ios_build_settings(target)
  end
end
  1. 再次执行pod install --verbose

方案3:使用预编译二进制版本替代源码编译

源码编译gRPC-Core耗时极长,可直接指定预编译二进制包:
在Podfile中添加gRPC-Core的二进制依赖配置(替换原有自动引入的版本):

pod 'gRPC-Core', :git => 'https://github.com/grpc/grpc.git', :tag => 'v1.50.1', :subspecs => ['Core'], :binary => true

然后执行pod install --verbose

方案4:排查Flutter插件的依赖冲突

部分Flutter插件可能强制引入了旧版gRPC,可执行以下命令查看完整依赖链:
pod deps
找到引入gRPC-Core的插件,尝试升级该插件到兼容iOS11.0的最新版本,或在pubspec.yaml中指定插件的稳定兼容版本。


内容的提问来源于stack exchange,提问作者Hasnain Elahi

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.18 07:05:09