【flutter】flutter doctor -v 查看flutter配置环境问题:X cmdline-tools component is missing 以及 X Android license

一、遇到报错:

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

在这里插入图片描述
在这里插入图片描述

3.6 查看检测结果

所有的问题全部解决!!!
在这里插入图片描述

  • 5
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值