HTTP host https://maven.google.com/ is not reachable. Reason: An error
原文:https://blog.csdn.net/weixin_47933729/article/details/124755372
flutter 搭建环境出现的问题
问题:
HTTP Host Availability ✗ HTTP host https://maven.google.com/ is not reachable. Reason: An error occurred while checking the HTTP host: Operation timed out ✗ HTTP host https://cloud.google.com/ is not reachable. Reason: An error occurred while checking the HTTP host: Operation timed out
解决:
这个由于国内网络问题,导致 maven.google.com/ 无法访问,需要在flutter sdk 里面的 flutter/packages/flutter_tools/lib/src/http_host_validator.dart 里面的
const List<String> androidRequiredHttpHosts = <String>[
'https://maven.google.com/',
];
替换为
const List<String> androidRequiredHttpHosts = <String>[
'https://dl.google.com/dl/android/maven2/',
];
然后删除 flutter\bin\cache 目录里面的 flutter_tools.snapshot 文件,重启命令窗口重新检测就会发现已解决即可
至于 cloud.google.com ,暂时没有找到替换的方案,后面用到了再解决。