Android工具链-我为Android设备开发(Android SDK版本30.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.

当前回答

Windows上的Android SDK管理器截图

从SDK管理器中安装工具请参见附件截图。

其他回答

从Android Studio打开SDK管理器。 SDK工具页 如图所示,检查Android SDK命令行工具 适用。 然后再跑扑医生

适用于Linux (Ubuntu)

在你的终端复制这个命令,然后用你的用户名(不带空格)修改“你的用户名”:

/home/your user name/Android/Sdk/tools/bin/sdkmanager --install "cmdline-tools;latest"

Windows上的Android SDK管理器截图

从SDK管理器中安装工具请参见附件截图。

我在Windows 10上通过以下操作解决了这个问题:

Run the following command in a Windows command prompt or Flutter console: flutter config --android-sdk "C:\Users\'your computer name' AppData\Local\Android\Sdk" (you may need to find and enter your own SDK path) The Android SDK location could be found in the Android Studio application* → Appearance & Behavior → System Settings → Android SDK Open your Android Studio, and then → File → Settings → Appearance & Behavior → System Settings → Android SDK → SDK Tools → download Android SDK Command-line Tools (latest) and you are good to go.

Windows用户

如果您在构建工具之后仍然看到相同的错误,安装工具并将其添加到用户/系统路径变量中,可能您的sdkmanager位置确实没有找到

只要输入

flutter config --android-sdk "C:\Users\{Your_User_Name}\AppData\Local\Android\Sdk" # (Default SDK location)

将“”内的路径添加到Android SDK文件夹所在的位置 然后,您可以运行许可证来验证任何未批准的许可证。

这对我很管用。