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

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

相关推荐
灏仟亿前端技术团队3 分钟前
DOMagic:把 AI 修改绑定到页面节点的前端开发态插件
前端
Lugas3 分钟前
浏览器为什么要如此严格地限制跨域请求?
前端·黑客·浏览器
Cobyte10 分钟前
17.响应式系统比对:链表如何实现响应式系统的高效更新
前端·javascript·vue.js
2601_9637713714 分钟前
Speeding Up Creative Agency Portfolios: A Performance Guide
前端·数据库·php
禅思院14 分钟前
AI对话前端从入门到崩溃:一个长对话引发的五层优化战争【二】
前端·前端框架·ai编程
IT_陈寒1 小时前
React useEffect里面写异步,我的状态怎么老丢?
前端·人工智能·后端
心中有国也有家1 小时前
Flutter 鸿蒙编译与构建流程深度解析
学习·flutter·华为·harmonyos
AI视觉网奇1 小时前
BambuStudio 自定义加载页面
服务器·前端·javascript
橙子家1 小时前
Extension storage、Interest groups 和 Shared storage 简介-浏览器缓存之【隐私沙盒与扩展专用存储】
前端
漂流瓶jz2 小时前
理解Webpack插件机制:从插件使用、各类编译对象、Tapable到自定义插件与钩子开发
前端·javascript·webpack