flutter doctor 后出现 HTTP host "ht

2023-07-27  本文已影响0人  舟_e9ce

出现的错误

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

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/(解决第一个问题)
再将 kPubDevHttpHost 和 kgCloudHttpHost 两个常量 分别修改为 https://pub.flutter-io.cn/ 和 https://storage.flutter-io.cn/(解决第二个)

3、去到flutter\bin目录,删除cache目录下的flutter_tools.snapshot 文件

4、新开一个cmd,在cmd命令窗口重新运行flutter doctor,问题解决。
转制:https://blog.csdn.net/qq_40166103/article/details/125673747

上一篇 下一篇

猜你喜欢

热点阅读