列出已安装和可用的软件包:
sdkmanager --list [options] \
[--channel=channel_id] // Channels: 0 (stable), 1 (beta), 2 (dev), or 3 (canary)
使用channel选项来包括从channel到channel_id之间的渠道中的包。例如,指定金丝雀渠道以列出所有渠道的软件包。
安装软件包:
sdkmanager packages [options]
packages
参数是一个SDK-style路径,需要用引号括起来(例如,"build-tools;25.0.0"
或"platforms;android-25"
)。您可以传递多个包路径,用空格分隔,但每个路径都必须用自己的一对引号括起来。
示例用法(在我的Mac上):
alex@mbpro:~/sdk/tools/bin$ ls ../../build-tools/
25.0.0/
alex@mbpro:~/sdk/tools/bin$ ./sdkmanager "build-tools;25.0.2"
done
alex@mbpro:~/sdk/tools/bin$ ls ../../build-tools/
25.0.0/ 25.0.2/
你还可以指定不同的选项,例如强制所有连接使用HTTP (--no_https
),或者使用代理服务器 (--proxy_host=address
和 --proxy_port=port
)。
要检查可用的选项,请使用--help
标志。在我的机器上(Mac),输出如下:
alex@mbpro:~/sdk/tools/bin$ ./sdkmanager --help
Usage:
sdkmanager [--uninstall] [<common args>] \
[--package_file <package-file>] [<packages>...]
sdkmanager --update [<common args>]
sdkmanager --list [<common args>]
In its first form, installs, or uninstalls, or updates packages.
<package> is a sdk-style path (e.g. "build-tools;23.0.0" or
"platforms;android-23").
<package-file> is a text file where each line is a sdk-style path
of a package to install or uninstall.
Multiple --package_file arguments may be specified in combination
with explicit paths.
In its second form (with --update), currently installed packages are
updated to the latest version.
In its third form, all installed and available packages are printed out.
Common Arguments:
--sdk_root=<sdkRootPath>: Use the specified SDK root instead of the SDK containing this tool
--channel=<channelId>: Include packages in channels up to <channelId>.
Common channels are:
0 (Stable), 1 (Beta), 2 (Dev), and 3 (Canary).
--include_obsolete: With --list, show obsolete packages in the
package listing. With --update, update obsolete
packages as well as non-obsolete.
--no_https: Force all connections to use http rather than https.
--proxy=<http | socks>: Connect via a proxy of the given type.
--proxy_host=<IP or DNS address>: IP or DNS address of the proxy to use.
--proxy_port=<port #>: Proxy port to connect to.
* If the env var REPO_OS_OVERRIDE is set to "windows",
"macosx", or "linux", packages will be downloaded for that OS.
--all
选项。谢谢。 - Alexander Malakhov# 在无头服务器上更新 Android SDK FILTER=工具、平台、android-20 (睡眠5秒,然后在[1]不断循环;做睡眠1秒;echo y;完成)
| Android更新sdk --no-ui --all
--filter ${FILTER} </code></pre> - i4niac