问题描述
使用flutter command line的时候出现如下错误
[√] Flutter (Channel stable, 2.5.3, on Microsoft Windows [Version 10.0.18363.1916], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
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
[√] Android Studio (version 4.1)
[√] VS Code
[√] VS Code, 64-bit edition (version 1.62.0)
[√] Connected device (2 available)
主要是配置的Android SDK环境未安装命令行工具
解决方案
打开Android Studio -> File -> Settings -> System Settings -> Android SDK
再次运行 flutter doctor 不报错,出现以下画面
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.5.3, on Microsoft Windows [Version 10.0.18363.1916], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1)
[√] VS Code
[√] VS Code, 64-bit edition (version 1.62.0)
[√] Connected device (2 available)
• No issues found!