Java Android Studio 在没有 sdkmanager 的情况下安装
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/60460429/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android Studio installs without sdkmanager
提问by Mark Ebden
I've been programming in Flutter using macOS 10.15.3, targeting iOS devices. Today I tried installing Android Studio also, to branch out. The installation went without errors, but in Library/Android/sdk/
there is no tools
subdirectory, which is a problem because sdkmanager
is supposed to be found within Library/Android/sdk/tools/bin
.
我一直在使用 macOS 10.15.3 在 Flutter 中编程,针对 iOS 设备。今天我也尝试安装 Android Studio,以进行扩展。安装没有错误,但Library/Android/sdk/
没有tools
子目录,这是一个问题,因为sdkmanager
应该在Library/Android/sdk/tools/bin
.
I noticed this because running flutter doctor
gave me:
我注意到这一点,因为跑步flutter doctor
给了我:
? Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
I tried reinstalling Android Studio (no difference). Other solutions posted online talk about the Java version, so I upgraded the JRE from 1.7 to 1.8 and tried reinstalling Android Studio (no difference), and then upgraded JDK to the latest (so now the Java version is 11.0.6) and tried installing Android Studio again (no difference). I also upgraded Flutter to v1.12.13+hotfix.8 during the above, but this error won't go away.
我尝试重新安装 Android Studio(没有区别)。网上发布的其他解决方案都是讲Java版本的,所以我把JRE从1.7升级到1.8,然后尝试重新安装Android Studio(没有区别),然后将JDK升级到最新(所以现在Java版本是11.0.6)并尝试安装再次Android Studio(没有区别)。在上面我也将 Flutter 升级到 v1.12.13+hotfix.8,但是这个错误不会消失。
If I type flutter doctor --android-licenses
then I get:
如果我输入flutter doctor --android-licenses
然后我得到:
Android sdkmanager tool not found (/Users/macuser/Library/Android/sdk/tools/bin/sdkmanager).
Try re-installing or updating your Android SDK,
visit https://flutter.dev/setup/#android-setup for detailed instructions.
This is how I first noticed that I'm missing part of Android Studio.
这就是我第一次注意到我缺少 Android Studio 的一部分的方式。
I tried cheating by creating a tools/bin
subdirectory myself and then copying sdkmanager
from a plugin's Library/Android/sdk/cmdline-tools/latest/bin
to my new Library/Android/sdk/tools/bin
. However, this didn't fool Flutter. Running flutter doctor --android-licenses
led to:
我试图通过tools/bin
自己创建一个子目录然后sdkmanager
从插件复制Library/Android/sdk/cmdline-tools/latest/bin
到我的新Library/Android/sdk/tools/bin
. 然而,这并没有欺骗 Flutter。跑步flutter doctor --android-licenses
导致:
A newer version of the Android SDK is required. To update, run:
/Users/macuser/Library/Android/sdk/tools/bin/sdkmanager --update
This is wrong because the Android SDK is the newest.
这是错误的,因为 Android SDK 是最新的。
Does anyone know why Android Studio would be consistently missing the tools/bin
subdirectory and the goodies inside? Thanks and sorry if I overlooked something basic.
有谁知道为什么 Android Studio 会一直缺少tools/bin
子目录和里面的好东西?如果我忽略了一些基本的东西,谢谢和抱歉。
采纳答案by Darish
Update 1 (2020-02-29)
更新 1 (2020-02-29)
Seems like latest version of Android SDK renamed the 'Android SDK tools' package into 'Android-SDK command line tools'.
But unfortunately current stable version of the Flutter SDK (v1.12.13+hotfix.8
) is not compatible with this change and it keeps showing error message.
似乎最新版本的 Android SDK 将“ Android SDK 工具”包重命名为“ Android-SDK 命令行工具”。但不幸的是,当前稳定版的 Flutter SDK ( v1.12.13+hotfix.8
) 与此更改不兼容,并且一直显示错误消息。
Workaround:
解决方法:
As @Mark Ebden suggested, You can simply Uncheck Hide Obsolete Packagescheckbox on the SDK toolspage and you'll see Android SDK Tools (Obsolete) 26.1.1. Install it and you are good to go. If you find anything missing, read the following detailed instructions.
正如@Mark Ebden 建议的那样,您只需在SDK 工具页面上取消选中隐藏过时的包复选框,您就会看到Android SDK Tools (Obsolete) 26.1.1。安装它,你就可以开始了。如果您发现任何遗漏,请阅读以下详细说明。
See thisissue on flutter repo for more info.
有关更多信息,请参阅flutter repo 上的此问题。
Here is the complete details you want while installing android studio with latest version of Mac OS.
这是在使用最新版本的 Mac OS 安装 android studio 时所需的完整详细信息。
1. Install Android Studio stable version.
1.安装Android Studio稳定版。
2. Open android studio
2.打开安卓工作室
3. open SDK manager. See the screen shot below.
3. 打开 SDK 管理器。请参阅下面的屏幕截图。
4. Make sure you have downloaded all required stuff. See the screenshots below.
4. 确保你已经下载了所有需要的东西。请参阅下面的屏幕截图。
Please note that, I am using a custom location (/Users/darish/development/sdk/android) for my Android SDK instead of the default location (Library/Android/sdk/)
请注意,我为我的 Android SDK使用自定义位置 ( /Users/darish/development/sdk/android) 而不是默认位置 (Library/Android/sdk/)
5. Go to your home directory and check whether there is a .bash_profile or not. If yes, open it, if no, create one. Add the following contents to that file.
5. 进入你的主目录并检查是否有 .bash_profile 。如果是,打开它,如果不是,创建一个。将以下内容添加到该文件中。
export PATH="$PATH:~/development/sdk/flutter/bin"
export ANDROID_HOME="/Users/darish/development/sdk/android"
export PATH="$PATH:$ANDROID_HOME/platform-tools"
6. Once all the above steps are done, run flutter doctor --android-licenses and accept all licenses.
6. 完成上述所有步骤后,运行 flutter doctor --android-licenses 并接受所有许可。
flutter doctor --android-licenses
7. Now run flutter doctor to see everything ok. If you need any further assistance, let me know. :)
7. 现在运行 flutter doctor 查看一切正常。如果您需要任何进一步的帮助,请告诉我。:)
That's all, have a nice day :)
就是这样,祝你有美好的一天:)
回答by Sebastian Juarez
What worked for me:
什么对我有用:
- Run flutter doctor --android-licenses -v
- I got a message that goes like:
- 运行 flutter doctor --android-licenses -v
- 我收到一条消息,内容如下:
$ flutter doctor --android-licenses -v Android sdkmanager tool not found (/Users/juarse1/Library/Android/sdk/tools/bin/sdkmanager). Try re-installing or updating your Android SDK, visit https://flutter.dev/setup/#android-setupfor detailed instructions.
throwToolExit (package:flutter_tools/src/base/common.dart:28:3) AndroidLicenseValidator.runLicenseManager (package:flutter_tools/src/android/android_workflow.dart:311:7) Doctor.diagnose (package:flutter_tools/src/doctor.dart:243:38)
$ flutter doctor --android-licenses -v Android sdkmanager 工具未找到(/Users/juarse1/Library/Android/sdk/tools/bin/sdkmanager)。尝试重新安装或更新您的 Android SDK,请访问 https://flutter.dev/setup/#android-setup以获取详细说明。
throwToolExit (package:flutter_tools/src/base/common.dart:28:3) AndroidLicenseValidator.runLicenseManager (package:flutter_tools/src/android/android_workflow.dart:311:7) Doctor.diagnose (package:flutter_tools/src/doctor.dart:243:38)
This is because Android SDK is not finding command tools, but this needs to be forced to pull from obsolete package, so: 3. Go to Android Studio -> Preferences -> System Settings -> Android SDK -> SDK Tools Section 4. Uncheck Hide Obsolete Packages at the bottom 5. Make sure BOTH options are checked:
这是因为 Android SDK 没有找到命令工具,但这需要强制从过时的包中拉取,因此: 3. 转到 Android Studio -> 首选项 -> 系统设置 -> Android SDK -> SDK 工具部分 4. 取消选中在底部隐藏过时的软件包 5. 确保选中 BOTH 选项:
Android SDK Platform-Tools AND Android SDK Tools (Obsolete)
Android SDK 平台工具和 Android SDK 工具(已过时)
- OK, close Android Studio
- Run flutter doctor --android-licenses, should work!
- 好的,关闭 Android Studio
- 运行 flutter doctor --android-licenses,应该可以工作!