如何在无头服务器上从命令行设置 Android sdk?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2684296/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 06:56:05  来源:igfitidea点击:

How to setup Android sdk from command-line on headless server?

androidsdkinstallheadless

提问by Eno

So far Ive managed to download and install the SDK and its in my PATH. Problem now is that I can't run "android update sdk" since it expects to be connected to a display and Im connected to a remote headless server through ssh (its a build server so there's no desktop env). Is there a command-line option for the android tool that tells it to run without X ?

到目前为止,我已经设法在我的 PATH 中下载并安装了 SDK 和它。现在的问题是我无法运行“android update sdk”,因为它希望连接到显示器,而我通过 ssh 连接到远程无头服务器(它是一个构建服务器,所以没有桌面环境)。android 工具是否有一个命令行选项可以告诉它在没有 X 的情况下运行?

回答by

There is a --no-uiflag for the update.

有一个--no-ui更新标志。

Typical linux setup:

典型的 linux 设置:

cd android-sdk-linux_86/tools
./android update sdk -u

This will run it headless. To note, -uand --no-uiare the same flag

这将使其无头运行。要注意,-u--no-ui是同一个标志

回答by cheetah

I just created a small command line tool that does the update in any environment (GUI or non-GUI). Didn't have the chance to test it extensively, but as far as I can tell it does what it should.

我刚刚创建了一个小型命令行工具,可以在任何环境(GUI 或非 GUI)中进行更新。没有机会对其进行广泛的测试,但据我所知,它应该做什么。

The command line tool updates a pre-installed base Android SDK with all currently available platforms, add-ons, extras, docs, samples and tools. This should be enough for a build server (I need this for my Hudson CI installation with Maven).

命令行工具使用所有当前可用的平台、附加组件、附加组件、文档、示例和工具更新预安装的基础 Android SDK。这对于构建服务器来说应该足够了(我的 Hudson CI 安装需要使用 Maven)。

Please go here for more details:

请到这里了解更多详情:

http://code.google.com/p/android-sdk-tool

http://code.google.com/p/android-sdk-tool