rss feed Twitter Page Facebook Page Github Page Stack Over Flow Page

Create an Android Virtual Device

It might be a good idea to test applications in the emulator first. The Android Virtual Device (avd) will allow you to create different type of devices simulating a real device.

To create a new AVD, we need to check first which one are available for us to use. To accomplish this, simply run the following command:

android list targets

This will output something like:

Available Android targets:
----------
id: 1 or "android-21"
     Name: Android 5.0
     Type: Platform
     API level: 21
     Revision: 1
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : android-tv/armeabi-v7a, android-tv/x86, default/armeabi-v7a, default/x86, default/x86_64
----------
id: 2 or "Google Inc.:Google APIs:21"
     Name: Google APIs
     Type: Add-On
     Vendor: Google Inc.
     Revision: 1
     Description: Android + Google APIs
     Based on Android 5.0 (API level 21)
     Libraries:
      * com.google.android.media.effects (effects.jar)
          Collection of video effects
      * com.android.future.usb.accessory (usb.jar)
          API for USB Accessories
      * com.google.android.maps (maps.jar)
          API for Google Maps
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : google_apis/armeabi-v7a, google_apis/x86, google_apis/x86_64

Now that we have the API 21 available, we can create the new emulator.

android create avd -n MyAndroid -t android-21 --abi armeabi-v7a

This will output something like this:

Android 5.0 is a basic Android platform.
Do you wish to create a custom hardware profile [no]
Created AVD 'MyAndroid' based on Android 5.0, ARM (armeabi-v7a) processor,
with the following hardware config:
hw.cpu.model=cortex-a8
hw.lcd.density=240
hw.ramSize=512
vm.heapSize=48

You can check your emulator by using this command:

android avd

Run the emulator

emulator -avd MyAndroid