---
title: "修复 Flutter doctor 的 HTTP Host availability 问题（无需修改SDK源码）"
date: 2023-04-04T20:30:31.000Z
author: Z.SHINCHVEN
tags: [Flutter, maven]
canonical: https://atlassc.net/2023/04/05/fix-flutter-doctor-http-host-availability-issue
---
如果你在东方墙国做软件开发，总会遇到很多人为制造的恶心问题。比如初次安装 Flutter SDK 时，运行 `flutter doctor` 时，在最后一步`HTTP Host availability check is taking a long time...`会变得很慢，最后报错：

```bash
HTTP Host availability check is taking a long time...[!] HTTP Host Availability
    ✗ HTTP host "https://pub.dev/" is not reachable. Reason: An error occurred
      while checking the HTTP host: Operation timed out
```

这是因为 Flutter 默认的 Android Maven 仓库被墙。

要解决这个问题很简单，只需在环境变量中配置`FLUTTER_STORAGE_BASE_URL`，将其指向一个可访问的 maven 镜像地址即可。

```bash
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PUB_HOSTED_URL=https://pub.flutter-io.cn # 同步你还可以增加这个环境变量来配置 pub 仓库镜像
# export FLUTTER_STORAGE_BASE_URL=https://dl.google.com/dl/android/maven2/
```

## References

- [Using Flutter in China](https://docs.flutter.dev/community/china)
