如何使用Google Play服务创建API-15模拟器(命令行)

Sub*_*ian 5 android emulation android-sdk-tools google-play-services

我的应用程序的一个用户特别面临某些问题API Level 15 (4.0.4),我想在我的最终重现这个问题.我没有4.0.4设备,我想为此目的创建和模拟器.我正在运行Android Studio 2.0-beta6,并且GUI AVD Manager根本不显示任何API-15模拟器图像.

因此,我已经使用独立版SDK manager来安装API-15x86级别的系统映像,然后创建一个AVD命令行,如下所示.

$ android create avd -n Api-15-Gnex -t 1
Run Code Online (Sandbox Code Playgroud)

Id 1API-15我机器上目标的ID .但是,这个系统图像显然错过了Google APIs它,我的应用依赖于Google Play services,我需要它们专门来重现这个问题.

如何创建API-15模拟器Google APIs?优选地,来自命令行,但不是必须的.

Sub*_*ian 10

感谢Raptor的评论.通过独立的SDK管理器,在API-15下,选择Google APIs并安装该软件包.这为开发环境添加了新目标.

$ android list targets
  ----------
  id: 5 or "Google Inc.:Google APIs:15"
    Name: Google APIs
    Type: Add-On
    Vendor: Google Inc.
    Revision: 3
    Description: Android + Google APIs
    Based on Android 4.0.3 (API level 15)
    Libraries:
      * com.android.future.usb.accessory (usb.jar)
          API for USB Accessories
      * com.google.android.media.effects (effects.jar)
          Collection of video effects
      * com.google.android.maps (maps.jar)
          API for Google Maps
    Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800
    Tag/ABIs : default/armeabi-v7a
Run Code Online (Sandbox Code Playgroud)

请注意,它是ARM映像,而不是x86.由于硬件加速不适用于低于15且不包括15的API,因此我认为并不重要.

然后使用此目标创建一个新的AVD.

$ android create avd --force -n Api-15-Gnex -t 5
    Auto-selecting single ABI armeabi-v7a
    Created AVD 'Api-15-Gnex' based on Google APIs (Google Inc.), ARM (armeabi-v7a) processor,
    with the following hardware config:
    hw.lcd.density=240
    hw.ramSize=512
    vm.heapSize=48
Run Code Online (Sandbox Code Playgroud)

现在,您可以从GUI AVD管理器启动它.