Flutter 报错 [☠] Network resources (the doctor check crashed)xxxx

vbnet 复制代码
[☠] Network resources (the doctor check crashed)
   ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at
 https://github.com/flutter/flutter/issues.
    ✗ Exception: Network resources exceeded maximum allowed duration of 0:04:30.000000

意思是:flutter doctor 在尝试联网检查(比如下载 Google Maven、Flutter 镜像等)时,耗时超过了 4 分钟半的上限,然后整个网络检查模块就崩溃了。


🎯 解决方案:彻底加速 Flutter 的网络访问(国内环境推荐)

✅ 1.确保你 .zshrc 配置了以下环境变量:

arduino 复制代码
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

你之前贴出来的配置里有这两项,确认已经启用(别忘了 source ~/.zshrc)。


✅ 2.配置 android/build.gradle 使用国内镜像:

rust 复制代码
allprojects {
    repositories {
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/repository/central' }
        maven { url 'https://maven.aliyun.com/repository/public' }
        google()
        mavenCentral()
    }
}

✅ 3.SDK Manager 中配置镜像源(如果你用 Android Studio)

在 Android Studio 中打开:

rust 复制代码
Preferences -> Appearance & Behavior -> System Settings -> Android SDK -> SDK Update Sites

把里面的 URL 改为阿里云的,例如:


✅ 4.升级 Flutter 后清缓存(可选但推荐)

rust 复制代码
flutter pub cache repair
flutter clean
flutter pub get

✅ 最后再试一遍:

复制代码
flutter doctor -v

如果还是卡,说明你的本地网络(代理、防火墙)可能影响了连接 ------ 可以尝试挂梯子或者使用手机热点临时连一下。

相关推荐
Elcker2 小时前
YnuoAgent(依诺):一个 npm 包,跑起属于自己的 AI 研发平台
前端·人工智能·npm
计算机魔术师2 小时前
发现2天,修复2个月:AI挖穿PHP后,卡兹克讲透攻防时间差
前端
风骏时光牛马3 小时前
测试标题001
前端
IT_陈寒3 小时前
Java性能优化完全指南
前端·人工智能·后端
电子IT笔记3 小时前
对接群晖NAS,上传和删除踩坑记录
前端·后端
计算机魔术师3 小时前
半年前说不缺钱,半年后150亿美元超募
前端
用户5708462574403 小时前
自动化发布器里最贵的 Bug:返回成功,但什么都没发生
前端
爱吃馒头不吃辣3 小时前
加一道题,改一天代码:题库即数据的降维打击
前端·架构
aiks_yuan3 小时前
Requestly规则使用技巧:前端联调、接口Mock与网络请求调试实战
前端
程序员老赵4 小时前
Docker 部署 MaxKB:轻松搭建企业级智能体平台
前端·docker·agent