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

Flutter升级后构建失败 提示Flutter/Flutter.h文件不存在如何解决?

Flutter升级后iOS构建Flutter/Flutter.h未找到错误解决方案

对应错误信息:

fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>

操作步骤

  • 清理Flutter项目缓存,重新拉取依赖
    在项目根目录依次执行以下命令:
    flutter clean
    rm pubspec.lock
    flutter pub get
    
  • 清理iOS端Pod缓存,重新安装依赖
    在项目根目录依次执行以下命令:
    cd ios
    rm -rf Pods Podfile.lock
    pod cache clean --all
    pod install
    
  • 升级依赖兼容版本
    你当前使用的shared_preferences: 0.5.12+4存在低版本Flutter兼容问题,可在pubspec.yaml中将该依赖版本调整为适配Flutter 1.22.5的最新兼容版本,范围可指定为shared_preferences: '>=0.5.12+4 <2.0.0',重新执行flutter pub get和pod install即可。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.05 06:51:04