← 返回命令列表

Linux command

sdkmanager 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

List

sdkmanager --list

List

sdkmanager --list_installed

Install

sdkmanager "platforms;android-35"

Install

sdkmanager "platforms;android-35" "build-tools;35.0.0"

Update

sdkmanager --update

Uninstall

sdkmanager --uninstall "build-tools;34.0.0"

Accept

yes | sdkmanager --licenses

Install

sdkmanager --sdk_root=[path] --channel=1 "platform-tools"

说明

sdkmanager manages Android SDK components from the command line, installing, updating, and removing platform packages, build tools, system images, and other SDK components. It is the headless counterpart to Android Studio's SDK Manager and is provided in the Android SDK Command-Line Tools package. Packages are identified by string paths like platforms;android-35 for platform APIs, build-tools;35.0.0 for compilation tools, and system-images;android-35;google_apis;x86_64 for emulator images. Multiple packages can be installed in a single command by separating them with spaces, each wrapped in quotes. License acceptance is required before installing packages. Running --licenses interactively accepts all pending licenses, which is essential for automated CI/CD setups where the SDK needs to be provisioned non-interactively.

参数

--list
List all available and installed packages.
--list_installed
List only installed packages.
--update
Update all installed packages to the latest versions.
--uninstall _PACKAGES_
Remove specified packages.
--licenses
Review and accept SDK licenses. Required before installing packages.
--sdk_root _PATH_
Specify the SDK installation directory (overrides ANDROID_HOME).
--channel _N_
Include packages from the specified channel: 0 (stable, default), 1 (beta), 2 (dev), 3 (canary).
--no_https
Use HTTP instead of HTTPS for downloads.
--verbose
Enable verbose output showing errors, warnings, and all messages.
--proxy _TYPE_
Connect via a proxy of the given type (http or socks).
--proxy_host _HOST_
IP or DNS address of the proxy.
--proxy_port _PORT_
Proxy port number.

FAQ

What is the sdkmanager command used for?

sdkmanager manages Android SDK components from the command line, installing, updating, and removing platform packages, build tools, system images, and other SDK components. It is the headless counterpart to Android Studio's SDK Manager and is provided in the Android SDK Command-Line Tools package. Packages are identified by string paths like platforms;android-35 for platform APIs, build-tools;35.0.0 for compilation tools, and system-images;android-35;google_apis;x86_64 for emulator images. Multiple packages can be installed in a single command by separating them with spaces, each wrapped in quotes. License acceptance is required before installing packages. Running --licenses interactively accepts all pending licenses, which is essential for automated CI/CD setups where the SDK needs to be provisioned non-interactively.

How do I run a basic sdkmanager example?

Run `sdkmanager --list` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --list do in sdkmanager?

List all available and installed packages.