Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create API-15 emulator with Google Play Services (Command Line)

One user of my app is facing certain issues specifically on API Level 15 (4.0.4), and I would like to reproduce the issue on my end. I don't have a 4.0.4 device, and I would like to create and emulator for this purpose. I'm running Android Studio 2.0-beta6, and the GUI AVD Manager does not show any API-15 emulator images at all.

So, I have then used the standalone SDK manager to install an API-15 level x86 system image, and then created an AVD from command line as follows.

$ android create avd -n Api-15-Gnex -t 1

Id 1 is the id of the API-15 target on my machine. But, this system image obviously misses the Google APIs in it, and my app depends on Google Play services, and I need them specifically to reproduce the issue.

How can I create API-15 emulator with Google APIs? Preferably from command line, but not necessarily.

like image 504
C-- Avatar asked Mar 09 '16 02:03

C--


People also ask

How do I run an emulator from command prompt?

Use the emulator command to start the emulator, as an alternative to running your project or starting it through the AVD Manager. Here's the basic command-line syntax for starting a virtual device from a terminal prompt: emulator -avd avd_name [ {- option [ value ]} … ]

How do I update Google Play services on my emulator?

You can update Google Play Services via the Play Store app in your emulator just as you would on a physical Android device from API 24.


1 Answers

Thanks to the comment from Raptor. Through stand alone SDK manager, under API-15, select Google APIs and install the package. This adds a new target to the development environment.

$ 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

Note that it is an ARM image, not x86. Since hardware acceleration is not available for APIs less than and including 15, it wont matter, I assume.

Then create a new AVD using this target.

$ 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

Now, you may launch it from the GUI AVD manager.

like image 166
C-- Avatar answered Nov 01 '22 09:11

C--