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

执行pod install报错:无法找到shared_preferences_foundation依赖的FlutterMacOS规范

解决 shared_preferences_foundation 依赖 FlutterMacOS 找不到的问题

以下是几个可行的解决步骤,按顺序尝试:

  • 更新并校验Flutter环境
    先确保你的Flutter SDK是最新稳定版,执行命令:

    flutter upgrade
    flutter doctor
    

    根据flutter doctor的提示补全缺失的依赖或配置。

  • 清理项目缓存

    1. 回到项目根目录,清理Flutter缓存:
      flutter clean
      
    2. 进入macos目录,清理Pod相关文件和缓存:
      cd macos
      pod deintegrate
      pod cache clean --all
      rm Podfile.lock
      rm -rf .symlinks
      
  • 重新生成MacOS平台配置
    回到项目根目录,执行命令重新生成macos平台的框架和配置文件:

    flutter create --platforms=macos .
    
  • 重新安装Pods
    再次进入macos目录,执行:

    pod install
    
  • 更新Pod仓库(可选)
    如果上述步骤无效,更新本地Pod仓库索引:

    pod repo update
    
  • 手动指定FlutterMacOS路径(可选)
    打开macos/Podfile,确认是否有以下配置,如果没有就添加:

    flutter_macos_path = File.join('..', '.symlinks', 'flutter', 'macos')
    load File.join(flutter_macos_path, 'Flutter', 'podhelper.rb')
    

    保存后重新执行pod install。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.17 08:52:37