颤振医生结果与“cmdline工具组件丢失”
我在这里和这里尝试了答案,但无济于事。
在Windows 10上安装Android Studio & Flutter后,当我运行时,我得到以下结果:flutter doctor
[√] Flutter (Channel stable, 2.5.0, on Microsoft Windows [Version 10.0.19043.1202], locale en-US)
[X] Android toolchain - develop for Android devices
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.
[√] Chrome - develop for the web
[√] Android Studio (version 2020.3)
[√] VS Code (version 1.60.0)
[√] Connected device (2 available)
打开卸载和重新安装不起作用。Android Studio > SDK Manager > Android SDK > SDK Tools
Android SDK Command-line Tools (latest)
我还在用户 PATH 环境变量中添加了 、 和 。<pathToSDK>\tools\bin
<pathToSDK>\platform-tools\
<pathToSDK>\cmdline-tools\latest\bin
按照颤动说明并运行(对我来说位于 )结果为:<pathToSDKManager> --install "cmdline-tools;latest"
<pathToSDK>\cmdline-tools\latest\bin
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
我无法找到任何关于此的文档,除了我需要在Java上安装一些版本并将其添加到我的路径中。https://flutter.dev/docs/get-started/install/windows 页面提到“请确保您安装了Java 8版本,并且您的JAVA_HOME环境变量设置为JDK的文件夹”,然后指出“Android Studio版本2.2及更高版本带有JDK,因此应该已经完成”,但没有进一步详细说明。
打开Android Studio并转到我可以看到Android Studio已经识别出已安装的Java的几个版本:File > Project Structure > Project > Project SDK