Code2care : TechZone Apps & Tutorials

How to create an Android Emulator Device AVD

Android Virtual Device a.k.a AVD is a tool for Android developers that simulates the actual Devices like Smart-phones, Watches, Tablets and TVs and runs on your computer. It looks just as the real device running Android Operating system but it does not have a cellular network (but still you can mock Calls and SMSes). You can test your Apps on these Emulators.

Why use these Emulators :

    API Options for Creating a Emulator

    Your App may support various flavors of Android Operating system versions depending upon what minSDK and maxSDK levels you set for your Application in AndroidManifest.xml file.

    So if set minSDK as = 3 and maxSDK = 21 , you need to test your application on various OS versions like : Cupcakes, Froyo, Eclair, Gingerbread, Honeycomb, IceCreamSandwitch, Jelly Bean, Kitkat and the latest version i.e Android 5.0 Lollipop if applicable. If your are a small developer or a startup its for sure that you may not have these many devices running all various OS, so Emulators are best suited to test your App for compatibilities on various OS systems.

    Further your App may support various screen sizes, so testing it on different screen sizes and resolutions is necessary , hence it is important to test it on screens ranging from 1.0" Android wears (if applicable) to 10.1" tablets or more!!

    Emulators also provides debug capabilities like console logs and logs generated by the kernel.

How to create an Android Emulator Device AVD :

    To create a new Android Emulator, you need to first start ADT eclipse . Go to the Menu -> Window, and select Android Virtual Device Manager

    If it is the first time your are running the AVD Manager then you may not see any device listed under Android Virtual Devices Tab.

    To create a new AVD , Click on Create button on the right.

    Android Virtual Device Manager

    Now the "Create new Android Virtual Device (AVD)" dialog comes up, with following fields and options,

    Create New Android Virtual Device Manager AVD

    1. AVD Name :

      It is the name of the Emulator (you can keep any name you like)

    2. Device :

    Device Option

      This is a drop-down menu with with device options that are available to create an emulator with different screen sizes and resolutions.

    List of devices Available :

    List of devices

    Android Wear

    Android Wear Round (320 x 320 : hdpi)
    Android Wear Square (280 x 280 : hdpi)

    Android Tablets

    Nexus 7 (2012) (7.0", 800 x 1280 : tvdpi)
    Nexus 7 (7.0", 1200 x 1920 : xhdpi)

    Nexus 10 (10.055", 2560 x 1600 : xhdpi)

    Android Phones

    Nexus One (3.7" , 480 x 800 : hdpi)
    Nexus S (4.0", 480 x 800 : hdpi)
    Galaxy Nexus (4.65" , 720 x 1280 : xdpi) Nexus 4 (4.7", 768 x 1280 : xhdpi)
    Nexus 5 (4.95", 1080 x 1920 : xxhdpi)
    Nexus 6 (5.96", 1440 x 2560, Normal 560dpi screen)
    Nexus 9 (8.9", 2048 x 1536, X-Large xhdpi screen)

    Android TVs

    Android TV (720p) (1280 x 720 : tvdpi)
    Android TV (1080p) (1920 x 1080p : xhdpi)

    Other Android Device Range

    2.7" QVGA (240 x 320 : ldpi)
    3.2" HVGA (320 x 480 : mdpi)
    3.3" WQVGA (240 x 400 : mdpi)
    3.4" WVGA (480 x 800 : hdpi)
    3.7" FWVGA (480 x 854 : hdpi)
    4.0" WVGA (480 x 800 : xhdpi)
    4.65" 720p (720 x 1280 : xhdpi)
    4.7" WXGA (1280 x 720 : mdpi)
    5.1" WVGA (480 x 800 : mdpi)
    5.4" FWVGA (480 x 854 : mdpi)
    7.0" WSVGA (Tablet) (1024 x 600 : mdpi)
    10.1" WXGA (Tablet) (1280 x 800 : mdpi)

3. Target :

    It is the API level : OS version that your AVD device will run on. Remember that if you only get a single API when you install Android Development tool (ADT) mostly the latest one that is available when you downloaded it, if you download ADT it now you will only get API Level 21 : i.e. L Preview

    Options :

    API 1 : Android 1.0
    API 2 : Android 1.1
    API 3 : Android 1.6 (Cupcake)
    API 4 : Android 1.6 (Donut)
    API 5 : Android 2.0 (Eclair)
    API 6 : Android 2.0.1 (Eclair)
    API 7 : Android 2.1 (Eclair)
    API 8 : Android 2.2 (Froyo)
    API 9 : Android 2.3 (Gingerbread)
    API 10 : Android 2.3.3 (Gingerbread)
    API 11 : Android 3.0 (Honeycomb)
    API 12 : Android 3.1 (Honeycomb)
    API 13 : Android 3.2 (Honeycomb)
    API 14 : Android 4.0 (IceCreamSandwich)
    API 15 : Android 4.0.3 (IceCreamSndwitch)
    API 16 : Android 4.1 (Jell Bean)
    API 17 : Android 4.2 (Jell Bean)
    API 18 : Android 4.3 (Jell Bean)
    API 19 : Android 4.4 (KitKat)
    API 20 : Android 4.4 (KitKat Wear)
    API 21 : Android 4.X (L Preview)

4. CPU/ABI :

    CPU/ABI : Application binary interface (ABI) is an interface between program like library and operating system modules at the system level, if you get the error here that "NO CPU/ABI System image available for this target" means that you do not any any CPU/ABI available/downloaded for a specific API level you have set as target. You need to go to "Android Device Manager" and download "Atom processor", "Intel Atom" or "ARM" for the Target API level that you have selected.

5. Keyboard :

    Its is a check box to enable/disable hardware keyboard for the emulator that you are creating.

6. Skin :

    Here you can set Hardware controls and skins, if you select dynamic hardware controls your emulator will have DialerPad, Call Pick/Drop, Back, Home and other options.

    QVGA (240x320, low density, small screen)
    WQVGA400 (240x400, low density, normal screen)
    WQVGA432 (240x432, low density, normal screen)
    HVGA (320x480, medium density, normal screen)
    WVGA800 (480x800, high density, normal screen)
    WVGA854 (480x854 high density, normal screen)
    WXGA720 (1280x720, extra-high density, normal screen)
    WSVGA (1024x600, medium density, large screen)
    WXGA800-7in (1280x800, high density, large screen)
    WXGA800 (1280x800, medium density, xlarge screen)

7. Front Camera :

    You can set a front Camara (by default it is disabled) using this option. You can use your Webcam as camera or if you do not have an Webcam you can use an Emulated camera too.

8. Back Camera :

    Like the front camera you can also set your back camera.

9. Memory Option :

    You can select the RAM size here. If you want to test your App like games, for perforce on devices with a low RAM you can set the RAM to a lower value say 256MB. You can also set the VM Heap size : Heap size that you allocate will be the max for Davlik VM available for your App. If you set it to a very low size then you may get the famous "Java Out of Memory exception" or Stack over flow exception"

10. Internal Memory :

    Every mobile phone is shipped with an internal memory. You can set how much internal memory you need for your emulator here in MB/GB

    Note : If you are on Windows and you set RAM more than 768MB then the emulator you create may fail and not laod. So it is advisable to set it a value less than 768MB.

11. SD Card :

    You can even simulate SD cards (External memory sticks) by setting Size in MB/GB. This is important to test your App if it uses SD cards for read and write of data.

13. Emulation Options :

    Here we have two Options :

    a. Snapshot :

      This is an important option when you create your AVD. If you enable this option the emulator RAM snapshot is saved when its 1st booted and hence when you boot your device next time it will be very quick compared to the time it will take when this option is not being selected (Just like the Hibernate option we have on Windows). So it is HIGHLY RECOMMENDED that you enable this option as if your hardware configuration is low, emulators may take 10-20 mins to boot up.

    b. GPU

      If you enable Graphical Processing Unit (GPU) you can use your computers OpenGL implementation. This will improve the graphics if you have a good GPU.

      Note : You cannot use both of these options at a time. You can only use either of them.

We are done creating our Emulator , jus click OK, and you would see the emulator that you just created listed under "Android Virtual Devices".

Listed AVDs shows its Target Name, Platform, API level and CPU/ABI that you have selected, if you want to see all the setting using Detail Button.

If want to do some changes you can do it using Edit Option.

To launch the AVD click on Start. You will be prompted Launch Option.

Here you can scale-up/scale-down the emulator size, wipe data on it disable/enable Launch from Snapshot options.

Now, click Launch button to launch the Emulator,

If you have selected Skin with Hardware controls you would see Volume, Home and direction, search buttons on the right top corner.

The first boot may take a little longer to load.

Running you Application on Emulator

Run Configuration

    In order to run your Application Right Click on your Application Project Folder and click on Run As -> Run Configuration. If you only have a single Emulator you can select Run As -> Android Application, but if you have multiple Emulator or you have attracted your device via USB cord then its better to go to run configurations.

    Run configuration options

    Here we have Options,

    1. Always prompt to pick device :

      When you select this option, you would always be prompted devices to choose from option when you run the project.

    2. Launch on all compatible devices and AVDs

      When selected all the emulators that are compatible with your Project will be launched.

    3. Automatically pick compatible device. Always uses preferred AVD if set below, launches on compatible device/AVD otherwise.

      Here you would see all the AVDs that you have created, the one that you select here will be Automatically picked when you run your project.

    You can even set Network Speed and Latency here.

    You can also add Additional Emulator Command line options.

Creating AVD from Device Definition Option

    This is the most easiest way to create an emulator that simulates a real Google device like Nexus Phones, Tables, Wears or TVs. Just select the Device and you will get the AVD Configuration screen populated with configuration that matches the real device.

Device Definitions


Posts related to android.

1. Share image and text Twitter using your Android Application Programatically

2. The Android Virtual Device 'myEmulator' is currently running an emulator and cannot be deleted.

3. Make Android View Scrollable both Horizontally and Vertically

4. Can we move apps like WhatsApp, Facebook to external MicroSD card

5. Parsing Data for android-21 failed unsupported major.minor version 51.0

6. Android : Prevent App for rotation landscape or portrait

7. ADT quit unexpectedly error on Mac OSX Android Eclipse SDK

8. Android-Failed to install apk on device EOF Timeout Error

9. How to change Android EditText Cursor Color

10. JavaDocs for Android SDK Eclipse IDE

11. Two Buttons next to each other in Android Layout

12. Change Title text for Android Activity using java code

13. How to add Newline to text in Android TextView

14. Android : Unable to load VM from snapshot : Mac OS X Error

15. INVALID FILE NAME: MUST CONTAIN ONLY [a-z0-9_.] Android Eclipse Error

16. Hide Tittle bar and Navigation bar from android activity

17. appcompat_v7 errors after updates to API level 21 Material Theme

18. How to Copy Text to Android Clipboard Programatically ClipboardManager (Both Old and New SDK)

19. [Solution] Running Android Lint has encountered a problem NullPointerException Error

20. Remove Trailing zeros BigDecimal Java


Popular tags
x 175
x 29
x 20
x 14
x 14
x 14
x 13
x 11

1000+ C Programs     PHP Tutorial     JSON Tutorial     Swift Tutorial     India Pinocdes     About Us     Privacy Policy

Code2care © 2012-17