How To Create And Start An Android Virtual Device(Emulator) To Run Appium Test

In previous post, We executed first appium test successfully in android mobile device. Also you can use Android Virtual Device(Emulators) to run automation tests on nadroid app using appium. So let's learnt how to create android emulator in windows system to rum appium test on it. This post will describe you how to create (AVD) In Windows.

What Is An Android Virtual Device(Emulators)?
In general term, an emulator is software or hardware that enables one computer system (Example : Windows) to behave like another computer system(Example : Android). It provides virtual environment of another system.

So here we can create emulator of android device in windows system to run appium test on it.

Creating Emulators(AVD) In Windows
If you remember, Earlier we have installed Android SDK in windows. Android SDK allows you to create emulators in windows. So let's try to create android emulator in windows.

PREREQUISITES :
  1. Java should be installed as described in THIS POST.
  2. Android SDK, it's all required packages and Intel Hardware Accelerated Execution Manager must be installed as described in THIS POST.
  3. Android environment variables should be set. View THIS POST.
Launch AVD Manager
SDK provides interface called AVD Manager to create android virtual devices. So first of all you need to start AVD Manager.
  • Open SDK folder. For me it is located at E:\SDK as described in SDK installation steps.
  • There will be "AVD Manager.exe" file.
  • Double click on "AVD Manager.exe". it will launch AVD manager dialog as shown bellow.

Create Android Virtual Device
Using AVD Manager interface, We can create emulator as described in bellow steps.
  • Click on Create button. It will open Create new Android Virtual Device dialog as shown bellow.

Note : In Target drop down, You need to select that API level for which you have installed system images during SDK installation. I have installed Android 5.1.1 - API Level 22 so selected it here. Also do not put space in AVD Name textbox.
  • Fill values in all fields as shown in above image and click on OK button.
  • It will create AVD and show message as shown bellow.
  • New created device will be listed on AVD manager as shown bellow.

Same way you can create any other size device emulators too as per your system images installation for different Android API levels.

Start AVD Emulator
Note : Please make sure you have minimum 2 GB RAM in your system. 4 GB RAM is recommended. AVD Emulator uses large amount of memory. So please close all non-required software applications before starting it.

To start Emulator
  • Select New create AVD 2.7_Inch_QVGA from list.
  • Click on Start Button as bellow.
  • It will show Launch Options dialog. Click on Launch button.
  • It will launch android emulator as shown in bellow image. Full launch can take time from 5 to 10 minutes based on your system configuration.
  • Wait for a while. Emulator screen will looks like bellow after few minutes. Be patient.

So now android emulator is launched.

Unlocking Emulator Screen 
Same as android mobile device, You can unlock emulator screen by dragging lock icon up by mouse as shown in bellow image.


After unlocking, Emulator screen will looks like bellow.


This way you can create and launch emulator for android device in windows system. We will use this emulator to automate different android apps in my upcoming posts.

Verify Emulator Detected
You can detect emulator from command prompt using command adb devices as shown in bellow image.


So my emulator is running fine and detected by my system.

5 comments:

  1. Hi,
    Please post next article. Although, its working fine with real devices, but I am unable to launch my app through emulator.

    This blog is really helpful and so easy to understand.

    Best Redards,
    Rachna

    ReplyDelete
  2. i m also not able to launch emulator

    ReplyDelete
    Replies
    1. Even am not bale to launch the emulator.

      Delete
  3. In my emulator, it just shows up as emulator and lock screen never show up.

    ReplyDelete