简体   繁体   English

使用'android'命令行实用程序定位特定的系统映像版本?

[英]Targeting a specific system-image version using the 'android' command line utility?

Background: I've created a headless OSX workstation-bootstrapping script, which installs android-sdk via homebrew and sets up a Chef-solo environment. 背景:我创建了一个无头的OSX工作站 - 自举脚本,它通过自制软件安装android-sdk并设置一个Chef-solo环境。 I mention this because any sensible tool/predictably-named remotely-hosted file is on the table for solutions. 我之所以提到这一点,是因为任何明智的工具/可预测命名的远程托管文件都在桌面上寻找解决方案。

My problem: I need the Android API 16 system-image and I can't seem to find the right flags/package namespace using the android CLI utility. 我的问题:我需要Android API 16系统映像,我似乎无法使用android CLI实用程序找到正确的标志/包命名空间。 I was able to install the 4.1.2/API 16 SDK Platform using android update sdk -u --filter android-16 , but I still need the system image for emulation. 我能够使用android update sdk -u --filter android-16安装4.1.2 / API 16 SDK平台,但我仍然需要系统映像进行仿真。

android update sdk -u --filter system-image installs API 17/4.2.2. android update sdk -u --filter system-image安装API 17 / 4.2.2。

I'd like to avoid doing a grep-based solution over running android list sdk , not that it seems to be an option anyway ( android list sdk | grep 'API 16' doesn't bear fruit). 我想避免在运行android list sdk做一个基于grep的解决方案,而不是它似乎无论如何都是一个选项( android list sdk | grep 'API 16'没有结果)。

I've looked at the XML file that the android CLI utility calls to enumerate its package list ( http://dl-ssl.google.com/android/repository/sys-img/x86/sys-img.xml ) and found a link to the file that I believe I want , http://dl-ssl.google.com/android/repository/sys-img/x86/sysimg_x86-16_r01.zip , but I'm not thrilled at the parse XML + go around the existing utility option. 我查看了android CLI实用程序调用以枚举其包列表的XML文件( http://dl-ssl.google.com/android/repository/sys-img/x86/sys-img.xml )并找到链接到我认为我想要的文件, http://dl-ssl.google.com/android/repository/sys-img/x86/sysimg_x86-16_r01.zip ,但我对解析XML +并不感到兴奋绕过现有的实用程序选项。

I've seen this other SO post and while it was helpful, it doesn't completely cover what I'm attempting to do. 我已经看过其他SO帖子 ,虽然它很有用,但它并没有完全覆盖我正在尝试做的事情。

Am I missing a flag or using the wrong package name? 我错过了一个标志或使用了错误的包名吗? If so, what documentation source did I miss? 如果是这样,我错过了哪些文档来源? How could I solve this for myself in the future? 我怎么能在将来为自己解决这个问题?

You can now use individual package identifiers. 您现在可以使用单个包标识符。 For your case, one of: 对于您的情况,其中一个:

echo y | android update sdk --no-ui --filter sys-img-x86-android-16 --all
echo y | android update sdk --no-ui --filter sys-img-armeabi-v7a-android-16 --all
echo y | android update sdk --no-ui --filter sys-img-mips-android-16 --all

The --all is necessary because without it, android will ignore packages it considers old even if they match the filter. --all是必要的,因为没有它, android会忽略它认为旧的包,即使它们匹配过滤器。

You can find a list of the identifiers with android list sdk --extended --all 您可以使用android list sdk --extended --all找到标识符android list sdk --extended --all

A slightly hackish solution, but here's how it can be done -- order matters in the running of the CLI commands. 一个稍微有点讨厌的解决方案,但是这里是如何完成的 - 在运行CLI命令时命令。

Get the Android API 16, 4.1.2 SDK Platform: 获取Android API 16,4.1.2 SDK平台:

echo -ne 'y' | android update sdk -u --filter android-16

Without API 17 installed, immediately install the system image. 如果未安装API 17,请立即安装系统映像。 Ostensibly, this will follow whichever the most recent version of SDK platform tools happen to respond on the box: 表面上看,这将遵循最新版本的SDK平台工具在框中做出响应:

echo -ne 'y' | android update sdk -u --filter system-image

If you want API 17, install android-17 and then run the system-image install command. 如果您需要API 17,请安装android-17然后运行system-image install命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM