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.

当前回答

我的解决方案是打开Android Studio,进入SDK管理器,切换到SDK工具选项卡,并检查Android SDK命令行工具(最新)。

不要忘记将SDK中的工具和平台工具文件夹添加到PATH中。

其他回答

如果颤振医生说的是这样的话

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/<admin>/Library/Android/sdk
✗ cmdline-tools component is missing
  Run `path/to/sdkmanager --install "cmdline-tools;latest"`

我的/to/sdkmanager路径是:

/Users/<user>/Library/Android/sdk/tools/bin/sdkmanager

所以对我来说,解决问题的方法就是跑步:

/Users/<user>/Library/Android/sdk/tools/bin/sdkmanager --install "cmdline-tools;latest"

如果你是Mac用户,只需打开终端并粘贴:

cd Library/Android/sdk/tools/bin./sdkmanager --install "cmdline-tools;latest"

然后按Enter键。

该命令将安装最新版本的cmdline-tools。

那就去找扑动医生,错误就会消失。

对我来说,运行这个命令效果很好:

flutter config --android-sdk /path/to/your/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.

macOS用户:

flutter config --android-sdk "/Users/{YOUR_USER_NAME}/Library/Android/sdk"

Then

flutter doctor --android-licenses

每一站都输入“y”。