您可以通过以下两种方式安装并接受SDK和工具的许可:
1. 通过命令行打开Android SDK管理器GUI
通过命令行打开Android SDK管理器,使用:
# Android SDK Tools 25.2.3 and lower - Open the Android SDK GUI via the command line
cd ~/Library/Android/sdk/tools && ./android
# 'Android SDK Tools' 25.2.3 and higher - `sdkmanager` is located in android_sdk/tools/bin/.
cd ~/Library/Android/sdk/tools/bin && ./sdkmanager
查看关于新的sdkmanager的更多详细信息。
选择并安装所需的工具。(您所在的位置可能不同)
2. 通过命令行安装和接受android许可证:
通过命令行更新包,您将看到您需要接受的条款和条件。
—安装或更新到最新版本
这将在您运行时安装最新的平台工具。
# Android SDK Tools 25.2.3 and lower. Install the latest `platform-tools` for android-25
android update sdk --no-ui --all --filter platform-tools,android-25,extra-android-m2repository
# Android SDK Tools 25.2.3 and higher
sdkmanager --update
-安装特定版本(25.0.1,24.0.1,23.0.1)
你也可以像这样安装一个特定的版本:
# Build Tools 23.0.1, 24.0.1, 25.0.1
android update sdk --no-ui --all --filter build-tools-25.0.1,android-25,extra-android-m2repository
android update sdk --no-ui --all --filter build-tools-24.0.1,android-24,extra-android-m2repository
android update sdk --no-ui --all --filter build-tools-23.0.1,android-23,extra-android-m2repository
# Alter the versions as required ↑ ↑
# -u --no-ui : Updates from command-line (does not display the GUI)
# -a --all : Includes all packages (such as obsolete and non-dependent ones.)
# -t --filter : A filter that limits the update to the specified types of
# packages in the form of a comma-separated list of
# [platform, system-image, tool, platform-tool, doc, sample,
# source]. This also accepts the identifiers returned by
# 'list sdk --extended'.
# List version and description of other available SDKs and tools
android list sdk --extended
sdkmanager --list