下载最新的flutter3.7.7,执行flutter doctor后报错
image.png
解决办法:
1、找到flutter sdk的文件目录,打开下面路径文件
flutter\packages\flutter_tools\lib\src\http_host_validator.dart
image.png
2、将http_host_validator.dart文件中的链接进行替换
将https://maven.google.com/改为:https://dl.google.com/dl/android/maven2/
将 const String kPubDevHttpHost = 'https://pub.dev/'; 改为 const String kPubDevHttpHost = 'https://pub.flutter-io.cn/';
将 const String kgCloudHttpHost = 'https://cloud.google.com/'; 改为 const String kgCloudHttpHost = 'https://storage.flutter-io.cn/';
如下图所示:
3、去到flutter\bin目录,删除cache目录下的 flutter_tools.snapshot 文件
image.png
4、运行:flutter doctor
image.png
网友评论