【flutter】报错 cmdline-tools component is missing

本文介绍了在FlutterSDK环境中遇到cmdline-toolscomponentismissing错误时的解决方法,包括安装AndroidSDKcommand-lineTools、使用AndroidStudio的SDKManager、以及修改AndroidSDK路径并使用flutterconfig命令配置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在flutterSDK目录下,双击flutter_console.bat,调出命令行。

输入flutter doctor,如果第三个诊断为[x],报cmdline-tools component is missing错(我这已经修改好了,所以是勾了),那就可以用以下方法解决。

解决方法

1.安装Android SDK command-line Tools

我使用的是Android studio,路径是Tools->SDK Manager

安装Android SDK command-line Tools就好。

然后在命令行执行如下命令

flutter doctor --android-licenses

 2.修改了android SDK目录

我执行了上面的操作没有解决问题,参考了flutter cmdline-tools component is missing可能的问题。-CSDN博客 。

还是Android SDK这个位置,我的Android SDK Location已经改了,是E:\AndroidSDK\Sdk\Sdk。

命令行输入如下命令:

flutter config --android-sdk "你自定义的sdk路径"

我输入了flutter config --android-sdk "E:\AndroidSDK\Sdk\Sdk" ,就解决了问题。

Flutter assets will be downloaded from https://storage.googleapis.com. Make sure you trust this source! Doctor summary (to see all details, run flutter doctor -v): [☠] Flutter (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 Error: Cannot find the executable for `where`. This can happen if the System32 folder (e.g. C:\Windows\System32 ) is removed from the PATH environment variable. Ensure that this is present and then try again after restarting the terminal and/or IDE. [√] Windows Version (Windows 10) [!] Android toolchain - develop for Android devices (Android SDK version 35.0.1) 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/to/windows-android-setup for more details. [X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [X] Visual Studio - develop Windows apps X Visual Studio not installed; this is necessary to develop Windows apps. Download at https://visualstudio.microsoft.com/downloads/. Please install the "Desktop development with C++" workload, including all of its default components [√] Android Studio (version 2024.3) [√] VS Code (version 1.98.1) [√] Connected device (1 available) [√] Network resources ! Doctor found issues in 4 categories.
03-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值