Flutter 医生找不到 sdkmanager

Flutter doctor can't find sdkmanager

所以我尝试在没有 Android Studio 的情况下安装 flutter,因为每当我尝试打开 Android Studio 时,我的 PC 运行速度非常慢。一开始一切都很顺利,但是当 flutter 尝试使用

获得 Android 许可证时
flutter doctor --android-licenses

它总是给我

C:\Windows\System32>flutter doctor --android-licenses
Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to
resolve this.

当我使用

进行检查时
flutter doctor --android-licenses -v

它给我

C:\Windows\System32>flutter doctor --android-licenses -v
Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to
resolve this.

#0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1      AndroidLicenseValidator.runLicenseManager (package:flutter_tools/src/android/android_workflow.dart:422:7)
#2      Doctor.diagnose (package:flutter_tools/src/doctor.dart:295:38)
#3      DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:50:47)
#4      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1274:12)
<asynchronous suspension>
#5      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1125:27)
<asynchronous suspension>
#6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#7      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#8      FlutterCommandRunner.runCommand.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
<asynchronous suspension>
#9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#10     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
<asynchronous suspension>
#11     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#12     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#13     main (package:flutter_tools/executable.dart:92:3)
<asynchronous suspension>

我的 PATH 有什么问题或者我需要先做些什么吗?如果可以帮助我,我会包括我的路径。

谢谢。

此错误可以从 android studio 解决,转到 SDK 工具并单击 android SDK 命令行工具并安装它们。

您似乎缺少命令行工具。

如果您想在不安装 Android studio 的情况下安装命令行工具,那么我建议您查看此网站 here。它列出了您无需安装 android studio 即可下载的所有 android sdk 工具。

如果你确实想安装 android studio 我最近才能够解决这个问题,方法是转到工具>SDK 管理器>SDK 工具并选择“Android SDK 命令行工具(最新)”,然后点击确定安装工具。

完成后尝试再次 flutter doctor --android-licenses

*N\B:我相信默认情况下您已经安装了命令行工具。 转到包含 sdkmanager.bat 文件的文件夹,然后从那里打开 cmd。 cmd 应显示打开它的文件夹。 运行 下面的命令,'sdkmanager.bat --install "cmdline-tools;latest" 完成 运行ning 任务后关闭 cmd 并打开一个新的并 运行 'flutter doctor'