解决HTTP host https://maven.google.com/ is not reachable

  • 发表于
  • flutter

更新flutter之后运行flutter doctor 出现错误:

[!] HTTP Host Availability
✗ HTTP host https://maven.google.com/ is not reachable. Reason: An error occurred while checking the HTTP
host: Operation timed out

解决方法

  1. 找到flutter sdk的文件目录,打开flutter/packages/flutter_tools/lib/src/http_host_validator.dart
  2. 将https://maven.google.com/ 修改为https://dl.google.com/dl/android/maven2/
  3. 关闭cmd命令窗口,重新打开cmd窗口
  4. 去到flutter/bin目录,删除cache文件夹
  5. 在cmd命令窗口重新运行flutter doctor,问题解决。