C:\Users\Administrator>flutter doctor -v
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
[√] Flutter (Channel stable, 3.7.0, on Microsoft Windows [版本 10.0.19044.1826], locale zh-CN)
• Flutter version 3.7.0 on channel stable at D:\soft_install\flutter_windows_3.7.0-stable\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b06b8b2710 (9 weeks ago), 2023-01-23 16:55:55 -0800
• Engine revision b24591ed32
• Dart version 2.19.0
• DevTools version 2.20.1
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
[X] Windows Version (Unable to confirm if installed Windows version is 10 or greater)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at D:\soft_install\Android\Sdk
• Platform android-33, build-tools 33.0.2
• ANDROID_HOME = D:\soft_install\Android\Sdk
解决 设置环境变量SDK安装文件夹
• Java binary at: D:\soft_install\Android\Android Studio4-1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
运行失败的话,gui界面的sdk 下载cmdline-tools,降低版本到8.0
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
• CHROME_EXECUTABLE = C:\Users\Administrator\AppData\Local\Google Chrome\Chromebin\chrome.exe
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 4.1)
• Android Studio at D:\soft_install\Android\Android Studio4-1
解决方法,先到gui界面的sdk 下载cmdline-tools工具,会自动下载到D:\soft_install\Android\Sdk\cmdline-tools
(1)配置Android studio的命令:flutter config --android-studio-dir=“D:\software\Android Studio\studio”
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] Connected device (2 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.19044.1826]
• Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.90
[√] HTTP Host Availability
• All required HTTP hosts are available
问题http
解决:
删除缓存 :Flutter SDK路径/flutter/bin/cache
进入
Flutter SDK路径/flutter/packages/flutter_tools/lib/src/http_host_validator.dart
/// Android specific required HTTP hosts.
List
return
// If kEnvCloudUrl is set, it will be used as the maven host
if (!platform.environment.containsKey(kEnvCloudUrl))
'https://maven.google.com',
];
}
改成:
/// Android specific required HTTP hosts.
List
return
// If kEnvCloudUrl is set, it will be used as the maven host
if (!platform.environment.containsKey(kEnvCloudUrl))
'https://dl.google.com/dl/',
];
}
再将 kPubDevHttpHost 和 kgCloudHttpHost 两个常量 分别修改为 https://pub.flutter-io.cn/ 和 https://storage.flutter-io.cn/(解决第二个)
const String kPubDevHttpHost = 'https://pub.flutter-io.cn/';
const String kgCloudHttpHost = 'https://storage.flutter-io.cn/';
链接:https://www.jianshu.com/p/d1a923b9d298