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

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

相关推荐
智算菩萨20 分钟前
实战:高级中文自然语言处理系统的Python设计与实现
前端·javascript·easyui
远山无期43 分钟前
解决Tailwind任意值滥用:规范化CSS开发体验
前端·css·eslint
用户54277848515401 小时前
Vue 3 中开发高阶组件(HOC)与 Renderless 组件
前端
HIT_Weston1 小时前
67、【Ubuntu】【Hugo】搭建私人博客(一)
前端·ubuntu·hugo
阿里巴啦1 小时前
用React+Three.js 做 3D Web版搭建三维交互场景:模型的可视化摆放与轻量交互
前端·react·three.js·模型可视化·web三维·web三维交互场景
Liu.7741 小时前
vue3组件之间传输数据
前端·javascript·vue.js
|晴 天|1 小时前
前端闭包:从概念到实战,解锁JavaScript高级技能
开发语言·前端·javascript
开发者小天1 小时前
react的拖拽组件库dnd-kit
前端·react.js·前端框架
用户4445543654262 小时前
在Android开发中阅读源码的指导思路
前端
晚烛2 小时前
实战前瞻:构建高安全、强协同的 Flutter + OpenHarmony 智慧金融移动银行平台(支持国产密码体系、生物认证与信创全栈适配)
安全·flutter·金融