11

我想通过命令行下载android sdk。我从命令https://stackoverflow.com/a/4569792/563306得到这个命令 我下载了 Android SDK r18 tar 文件。提取它并在工具目录中,

我试过这个命令

>android update sdk --no-ui 

它给出了一个错误,

Error: Flag '--no-ui' is not valid for 'update sdk'.

另外,我没有看到 --no-ui 选项

android --help

Google 是否更改了命令行选项

当我提供帮助时,我得到了这个,

android --help update sdk

Usage:
  android [global options] action [action options]

Global options:
  -v --verbose  Verbose mode: errors, warnings and informational messages are printed.
  -h --help     Help on a specific command.
  -s --silent   Silent mode: only errors are printed out.

Valid actions are composed of a verb and an optional direct object:
-   list             : Lists existing targets or virtual devices.
-   list avd         : Lists existing Android Virtual Devices.
-   list target      : Lists existing targets.
- create avd         : Creates a new Android Virtual Device.
-   move avd         : Moves or renames an Android Virtual Device.
- delete avd         : Deletes an Android Virtual Device.
- update avd         : Updates an Android Virtual Device to match the folders of a new SDK.
- create project     : Creates a new Android Project.
- update project     : Updates an Android Project (must have an AndroidManifest.xml).
- create test-project: Creates a new Android Test Project.
- update test-project: Updates an Android Test Project (must have an AndroidManifest.xml).
- create lib-project : Creates a new Android Library Project.
- update lib-project : Updates an Android Library Project (must have an AndroidManifest.xml).
- update adb         : Updates adb to support the USB devices declared in the SDK add-ons.
- update sdk         : Updates the SDK by suggesting new platforms to install if available.


Action "list ":
  Lists existing targets or virtual devices.
Options:
  No options

Action "list avd":
  Lists existing Android Virtual Devices.
Options:
  No options

Action "list target":
  Lists existing targets.
Options:
  No options

Action "create avd":
  Creates a new Android Virtual Device.
Options:
  -c --sdcard   Path to a shared SD card image, or size of a new sdcard for the new AVD
  -t --target   Target id of the new AVD [required]
  -n --name     Name of the new AVD [required]
  -p --path     Location path of the directory where the new AVD will be created
  -f --force    Force creation (override an existing AVD)
  -s --skin     Skin of the new AVD

Action "move avd":
  Moves or renames an Android Virtual Device.
Options:
  -p --path     New location path of the directory where to move the AVD
  -n --name     Name of the AVD to move or rename [required]
  -r --rename   New name of the AVD to rename

Action "delete avd":
  Deletes an Android Virtual Device.
Options:
  -n --name     Name of the AVD to delete [required]

Action "update avd":
  Updates an Android Virtual Device to match the folders of a new SDK.
Options:
  -n --name     Name of the AVD to update [required]

Action "create project":
  Creates a new Android Project.
Options:
  -n --name     Project name
  -t --target   Target id of the new project [required]
  -p --path     Location path of new project [required]
  -k --package  Package name [required]
  -a --activity Activity name [required]

Action "update project":
  Updates an Android Project (must have an AndroidManifest.xml).
Options:
  -p --path     Location path of the project [required]
  -l --library  Location path of an Android Library to add, relative to the main project
  -n --name     Project name
  -t --target   Target id to set for the project
  -s --subprojects Also update any projects in sub-folders, such as test projects.

Action "create test-project":
  Creates a new Android Test Project.
Options:
  -p --path     Location path of new project [required]
  -m --main     Location path of the project to test, relative to the new project [required]
  -n --name     Project name

Action "update test-project":
  Updates an Android Test Project (must have an AndroidManifest.xml).
Options:
  -m --main     Location path of the project to test, relative to the new project [required]
  -p --path     Location path of the project [required]

Action "create lib-project":

  Creates a new Android Library Project.
Options:
  -n --name     Project name
  -p --path     Location path of new project [required]
  -t --target   Target id of the new project [required]
  -k --package  Package name [required]

Action "update lib-project":
  Updates an Android Library Project (must have an AndroidManifest.xml).
Options:
  -p --path     Location path of the project [required]
  -l --library  Location path of an Android Library to add, relative to the main project
  -t --target   Target id to set for the project

Action "update adb":
  Updates adb to support the USB devices declared in the SDK add-ons.
Options:
  No options

Action "update sdk":
  Updates the SDK by suggesting new platforms to install if available.
Options:
  No options
4

4 回答 4

14

这对我来说可以。在没有标志的情况下尝试它--no-ui,看看是否有效。如果不是,您收到的错误信息是什么?


编辑:

您可能PATH配置不正确。您需要执行“当前文件夹可执行文件”,如下所示:

$ ./android update sdk --no-ui
于 2012-06-08T00:25:20.447 回答
5

如果您使用的是 Android SDK Tools Rev 19,您应该得到

$ android --help update sdk

       Usage:
       android [global options] update sdk [action options]
       Global options:
  -h --help    : Help on a specific command.
  -v --verbose : Verbose mode, shows errors, warnings and all messages.
  -s --silent  : Silent mode, shows errors only.

                     Action "update sdk":
  Updates the SDK by suggesting new platforms to install if available.
Options:
     --proxy-port: HTTP/HTTPS proxy port (overrides settings if defined)
     --proxy-host: HTTP/HTTPS proxy host (overrides settings if defined)
  -s --no-https  : Uses HTTP instead of HTTPS (the default) for downloads.
  -a --all       : Includes all packages (such as obsolete and non-dependent
                   ones.)
  -f --force     : Forces replacement of a package or its parts, even if
                   something has been modified.
  -u --no-ui     : Updates from command-line (does not display the GUI)
  -p --obsolete  : Deprecated. Please use --all instead.
  -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'.
  -n --dry-mode  : Simulates the update but does not download or install
                   anything.

and -uor--no-ui是选项之一。

于 2012-06-08T02:08:42.313 回答
0

只是补充。当您使用代理选项时,不要提供 http:// 部分。android 可执行文件不会抱怨,并且会报告下载的一切正常。我进行了全新的安装,并确定尚未下载任何内容。

于 2012-10-30T11:41:02.233 回答
0

它是如此简单:

# ./android update sdk -u
于 2013-12-19T08:37:09.653 回答