一、遇到报错:
PS C:\Users\Administrator> flutter doctor -v
[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [版本 10.0.19044.1889], locale zh-CN)
• Flutter version 3.0.5 at D:\CODEInterpreter\flutter3.0.5
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (7 weeks ago), 2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at D:\CODEInterpreter\AndroidSDK
X cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Enterprise 2019 16.11.18)
• Visual Studio at D:\CODEIDE\VisualStudio2019
• Visual Studio Enterprise 2019 version 16.11.32802.440
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 3.5)
• Android Studio at D:\CODEIDE\AndroidStudio3.5.2
• Flutter plugin version 44.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] IntelliJ IDEA Ultimate Edition (version 2019.3)
• IntelliJ at D:\CODEIDE\IntelliJ IDEA 2019.3.3
• 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
[√] Connected device (2 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.19044.1889]
• Chrome (web) • chrome • web-javascript • Google Chrome 104.0.5112.81
HTTP Host availability check is taking a long time...[☠] HTTP Host Availability (the doctor check crashed)
X Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at
https://github.com/flutter/flutter/issues.
X HandshakeException: Connection terminated during handshake
•
! Doctor found issues in 2 categories.
二、异常原因:
2.1 问题1:cmdline-tools component is missing
运行flutter doctor 出现了错误,这是因为没安装cmdline-tools工具。
2.2 问题2:Android license status unknown.
flutter doctor 如果提示Android license status unknown.表明没有安装android 证书。
执行命令:flutter doctor --android-licenses
2.3 问题3:HTTP Host availability check is taking a long time…
在用户环境变量中配置:
FLUTTER_STORAGE_BASE_URL = https://storage.flutter-io.cn
PUB_HOSTED_URL = https://pub.flutter-io.cn
三、解决方案:
3.1 选择 SDK Manager
3.2 选择Android SDK platform-Tools
3.3 进行安装
3.4 安装证书
执行 flutter doctor --android-licenses
安装的证书的数量有几个,不断输入 y
确认即可,这样会提示所有的证书全部安装成功!
3.5 配置镜像网络环境变量
FLUTTER_STORAGE_BASE_URL = https://storage.flutter-io.cn
PUB_HOSTED_URL = https://pub.flutter-io.cn
文章来源:https://www.toymoban.com/news/detail-578410.html
3.6 查看检测结果
所有的问题全部解决!!!
文章来源地址https://www.toymoban.com/news/detail-578410.html
到了这里,关于【flutter】flutter doctor -v 查看flutter配置环境问题:X cmdline-tools component is missing 以及 X Android license的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!