如何使用 sdkmanager 安装 Android Virtual Device manager 和 intel 系统镜像

How to install Android Virtual Device manager and intel system image with sdkmanager

我正在尝试仅使用命令行工具创建 android 模拟器。

我已经下载了 sdkmanager 并成功安装了 "platform"

sdkmanager "platforms;android-25"。但是我无法安装系统映像,因为 sdkmanager --list 给出这个

system-images;a...ult;armeabi-v7a | 4            | ARM EABI v7a System Image        
  system-images;a...-10;default;x86 | 4            | Intel x86 Atom System Image      
  system-images;a...pis;armeabi-v7a | 5            | Google APIs ARM EABI v7a Syste...

有人认为我不需要查看要安装的软件包的完整名称。但与此同时,当尝试从此列表中安装某些东西时,sdkmanager 似乎不这么认为。

除了您收到的评论之外,您还可以使用工具文件夹中的 "android" 脚本,这是我机器上的输出(我已截断输出):

[user@pc:~/sdk/tools]
└─ $ ▶ ./android list sdk

******************************************************************
The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
*********************************************************************
"android" SDK commands can be translated to sdkmanager commands on a 
best-effort basis.
Continue? (This prompt can be suppressed with the --use-sdk-wrapper 
command-line argument
or by setting the USE_SDK_WRAPPER environment variable) [y/N]: y
Running /home/user/sdk/tools/bin/sdkmanager --list --verbose

Info: Parsing /home/user/sdk/build-tools/24.0.3/package.xml
Info: Parsing /home/user/sdk/build-tools/25.0.2/package.xml
Info: Parsing /home/user/sdk/emulator/package.xml
Info: Parsing /home/user/sdk/patcher/v4/package.xml
...
Info: Parsing /home/user/sdk/tools/package.xml
Warning: File /home/user/.android/repositories.cfg could not be loaded.
Installed packages:
--------------------------------------
build-tools;24.0.3
    Description:        Android SDK Build-Tools 24.0.3
    Version:            24.0.3
    Installed Location: /home/user/sdk/build-tools/24.0.3

build-tools;25.0.2
    Description:        Android SDK Build-Tools 25.0.2
    Version:            25.0.2
    Installed Location: /home/user/sdk/build-tools/25.0.2
...
system-images;android-25;google_apis;x86_64
    Description:        Google APIs Intel x86 Atom_64 System Image
    Version:            4

为确保我们在同一页面上:

  • 我已经从 this site 下载了文件 tools_r25.2.3-linux.zip。将其解压缩到 ~/sdk

  • 我使用 tools/sdkmanager:

  • 安装了这个包

构建工具;24.0.3
build-tools/25.0.2
模拟器 | 26.0.0
平台工具 | 25.0.4
平台;android-24 | 2
平台;android-25 | 3
工具 | 26.0.1

编辑:阅读整个命令输出后,发现您还可以使用 --verbose 标志:

[user@pc:~/sdk/tools]
└─ $ ▶ sdkmanager --list --verbose