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工具链-我为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.
当前回答
我的解决过程如下:
~/Library/Android/sdk/tools/bin/sdkmanager --install "cmdline-tools;latest" Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156) at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75) at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81) at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73) at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48) Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519) ... 5 more Install Android SDK Command-line Tools in Android Studio: Preferences → Appearance & Behavior → System Settings → Android SDK → SDK Tools → Android SDK Command-line Tools (latest) flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 2.5.0, on macOS 11.5.2 20G95 darwin-x64, locale zh-Hans-CN) [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3) [✓] Xcode - develop for iOS and macOS [✓] Chrome - develop for the web [✓] Android Studio (version 2020.3) [✓] IntelliJ IDEA Ultimate Edition (version 2021.2) [✓] IntelliJ IDEA Ultimate Edition (version 2021.2) [✓] Connected device (2 available) • No issues found!
其他回答
我的解决方案是打开Android Studio,进入SDK管理器,切换到SDK工具选项卡,并检查Android SDK命令行工具(最新)。
不要忘记将SDK中的工具和平台工具文件夹添加到PATH中。
您的Android SDK版本需要更新。
打开Android Studio→点击顶部栏的Android Studio→首选项→外观&行为(点击打开下拉菜单)→系统设置(点击打开下拉菜单)→Android SDK→SDK工具(选项卡)。
检查Android SDK命令行工具(最新)→应用→单击确定。更新完成后,运行flutter doctor。
外观和行为菜单的截图
我在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.
我从Android Studio安装了Android SDK平台工具。这帮助我解决了这个错误。
安装前错误
从Android Studio安装平台工具
安装平台工具后
由于我的Android Studio开始屏幕看起来与上面的答案不同,我想分享我的解决方案:
打开Android Studio,点击欢迎屏幕上的“more actions”。 点击“SDK管理器”
在“*首选项”窗口转到“*SDK Tools•”选项卡 选择“Android SDK命令行工具(最新)”复选框。 点击“应用”。