本文介绍: [X] Android toolchaindevelop for Android devices X Unable to locate Android SDK. Install Android Studio from: https://developer.android.com/studio/index.html On first launch it will assist you in installing the Android SDK components.

几个Flutter常见诊断错误解决

jcLee95https://blog.csdn.net/qq_28550263
https://blog.csdn.net/qq_28550263/article/details/132869987


Flutter 诊断常见问题

问题1:

问题描述

[X] Android toolchain - develop for Android devices
    X Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

原因分析

这个错误表示找不到Android SDK。可能的原因是Android Studio没有安装或者安装路径没有正确配置

解决办法

PS > flutter config --android-sdk D:AndroidSDK
Setting "android-sdk" value to "D:AndroidSDK".

You may need to restart any open editors for them to read new settings.

问题2:

问题描述

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ 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.

原因与解决

这个错误信息表明 Flutter 环境缺少必要的Android工具链和SDK许可证。以下是针对每个错误的解决

1. 错误信息cmdlinetools组件缺失
cmdline-tools component is missing
  Run `path/to/sdkmanager --install "cmdline-tools;latest"`

解决方法

2. 错误信息:Android许可证状态未知
✗ Android license status unknown.
  Run `flutter doctor --android-licenses` to accept the SDK licenses.

解决方法

  • 运行以下命令以接受Android SDK的许可证:
    flutter doctor --android-licenses
    
  • 运行命令时,你可能会被要求确认或接受许多许可证,例如:
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
7 of 7 SDK package licenses not accepted. 100% Computing updates...
Review licenses that have not been accepted (y/N)? Y 

输入y来接受它们,然后回车确定。

完成上述步骤后,你的Flutter环境应该能够正常运行,并且不再显示这些错误信息。如果你遇到其他问题,请检查Flutter和Android SDK的安装,并确保它们都正确配置

问题3:

问题描述
[!] Network resources
    ✗ An HTTP error occurred while checking "https://github.com/": 信号超时时间已到

这个错误信息表明在尝试检查GitHub上的资源时发生了HTTP错误,并且错误信息中提到”信号超时时间已到”。这通常是由于网络问题或GitHub服务器不可访问引起的。以下是一些可能的解决方法:

原文地址:https://blog.csdn.net/qq_28550263/article/details/132869987

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。

如若转载,请注明出处:http://www.7code.cn/show_8799.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注