android - 如何读取 android sdkmanager 输出以便安装软件包?

标签 android

android sdkmanager 工具有一种方法可以几乎列出可用的包,如下所示:

$ 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...
  system-images;a...google_apis;x86 | 5            | Google APIs Intel x86 Atom Sys...
  system-images;a...ult;armeabi-v7a | 2            | ARM EABI v7a System Image
  system-images;a...ult;armeabi-v7a | 4            | ARM EABI v7a System Image
  system-images;a...15;default;mips | 1            | MIPS System Image
  system-images;a...-15;default;x86 | 4            | Intel x86 Atom System Image
  system-images;a...pis;armeabi-v7a | 5            | Google APIs ARM EABI v7a Syste...
  system-images;a...google_apis;x86 | 5            | Google APIs Intel x86 Atom Sys...
  system-images;a...ult;armeabi-v7a | 4            | ARM EABI v7a System Image
  system-images;a...16;default;mips | 1            | MIPS System Image
  system-images;a...-16;default;x86 | 5            | Intel x86 Atom System Image
  system-images;a...pis;armeabi-v7a | 5            | Google APIs ARM EABI v7a Syste...
  system-images;a...google_apis;x86 | 5            | Google APIs Intel x86 Atom Sys...
  system-images;a...ult;armeabi-v7a | 5            | ARM EABI v7a System Image
  system-images;a...17;default;mips | 1            | MIPS System Image
  system-images;a...-17;default;x86 | 3            | Intel x86 Atom System Image
  system-images;a...pis;armeabi-v7a | 5            | Google APIs ARM EABI v7a Syste...
  system-images;a...google_apis;x86 | 5            | Google APIs Intel x86 Atom Sys...
  system-images;a...ult;armeabi-v7a | 4            | ARM EABI v7a System Image
  system-images;a...-18;default;x86 | 3            | Intel x86 Atom System Image
  system-images;a...pis;armeabi-v7a | 5            | Google APIs ARM EABI v7a Syste...
  system-images;a...google_apis;x86 | 5            | Google APIs Intel x86 Atom Sys...

我想了解如何实际读取输出,以便我可以从命令行安装其中一个软件包。

最佳答案

您需要使用 --verbose 标志来获取完整的包名称:

sdkmanager --list --verbose

输出看起来像这样:

system-images;android-25;android-wear;armeabi-v7a
    Description:        Android Wear ARM EABI v7a System Image
    Version:            3
    Dependencies:
        patcher;v4

system-images;android-25;android-wear;x86
    Description:        Android Wear Intel x86 Atom System Image
    Version:            3
    Dependencies:
        patcher;v4

system-images;android-25;google_apis;arm64-v8a
    Description:        Google APIs ARM 64 v8a System Image
    Version:            4

system-images;android-25;google_apis;armeabi-v7a
    Description:        Google APIs ARM EABI v7a System Image
    Version:            4

system-images;android-25;google_apis;x86
    Description:        Google APIs Intel x86 Atom System Image
    Version:            4

system-images;android-25;google_apis;x86_64
    Description:        Google APIs Intel x86 Atom_64 System Image
    Version:            4

关于android - 如何读取 android sdkmanager 输出以便安装软件包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44241673/

相关文章:

android - 如何使用 Youtube API 在 RecyclerView 中加载 Youtube 缩略图

android - 广告叠加层需要在 intent extras 中使用 useClientJar 标志。

android - 将 Android Studio 3.4 更新到 3.5.1 时出现更新错误

android - 在android中处理按钮上的多个点击事件

javascript - JSON 响应解析错误 - Javascript

android - 将文件结构表示为 JSON

android - Galaxy S 加载网页的 Webview 行为需要很长时间

android - ImageView - getImageBitmap()?

android - 使用 minSdkVersion 之外的 API 级别的属性

java - 亚洲语言中带年份的日期格式