In this article, we look at how to setup Android Emulator in windows using Android Studio. We learnt how to install NativeScript in the windows in the last tutorial. Before starting with the NativeScript, we need to create an Android Virtual Device (AVD). The AVD is then used by the Android emulator mimic the device so that we can test our application.
In this article
- What is AVD Manager
- What is Android Virtual Device
- What is Android Emulator
- Why Use Emulator
- How does the Emulator work
- Disabling Hyper-V
- System Requirement to run Android Emulator
- Creating AVD
- Managing the AVD
- Editing/Deleting the AVD
What is AVD Manager
The AVD Manager is a UI interface provided by Android Studio. It helps you to create and manage Android Virtual Devices. You can access the AVD Manager from the Android Studio from the menu Tools -> AVD Manager ( or Tools -> Android -> AVD Manager in the older version of the studio)
What is Android Virtual Device
An Android Virtual Device (AVD) is an emulator configuration that represents a specific Android Device. An AVD contains a hardware profile, system image, storage area, skin, and other properties specific to the device.
You have to create AVD for every device that you want to test.
What is Android Emulator
The Android emulator is a program which takes the configuration from the Android Virtual Device (AVD), and simulates the device in your computer.
The Android Emulator needs AVD to run. You need to specify which AVD to use to the Android Emulator and Emulator mimics the device.
Why Use Emulator
You can use the real device to run and test your Android application, which is actually better and faster way to test your app
But, you need device of every size, type (like the tablet, phone, wear, tv) etc and with the various configuration like RAM, API Version, Network supported etc. This is something which is not possible if you are using the real dev. Creating AVD for any combination of size, type and configuration you can test your app, before releasing it to the Production.
How does the Emulator work
The Android emulator uses the Operating system Virtualization technologies to mimic the real device on your PC
Operating system virtualization is the technique, where a software is used to run many operating systems in the hardware at the same time. Some of the virtualisation technologies used in windows are
- Virtual Box
- Intel HAXM
Intel’s HAXM (Hardware Accelerated Execution Manager). Is used by the Android Emulator.
A Windows CPU can support only one virtualization technology at a time. The Hyper-V is installed, when you install the Windows OS. if it is enabled, you need to disable it.
Follow these steps to disable Hyper-V
- Go to Control Panel -> Programs and Features -> Turn Windows features on or off
- From the window disable Hyper-V options
- Reboot your machine
System Requirement to run Android Emulator
- Microsoft Windows 7 and above either 32bit/64bit.
- 3 GB RAM minimum, 8 GB RAM recommended
- 2 GB of available disk space minimum,
- 4 GB Hard disk space Recommended (500 MB for IDE + 1.5 GB for Android SDK and emulator system image)
- 1280 x 800 minimum screen resolution
- Java Developer Kit 8 and above
- Start Android Studio and open the AVD Manager
- Tools -> AVD Manager ( or Tools -> Android -> AVD Manager )
- Click AVD Manager icon in the toolbar.
Create New Virtual Device
If you are starting the AVD Manager for the first time, you will see the following screen. Else you will see the list of AVDs created.
Click on Create Virtual Device to continue
This will take you to select Hardware Page. This page lists the devices which can be used to generate the Android Virtual Device
In the left-hand panel displays a list of the Category of the device. It includes TV, Phone, Wear & Tablet. Select the category.
The middle pane displays the list of devices available. Select any one based on the requirement of your app. After this click on the Next button.
Note that phones with larger resolution Choose the pixels resolution according to your requirements as it will take huge RAM in large pixels resolution device. If your computer has low RAM then prefer to choose less resolution device.
Click Next to continue
Select System Image
The Recommend tab lists the recommended system images for the Hardware you have selected in the last page. There x86 images and other images tabs also display the list of images.
Choose the system image based on the API level targeted by your App. The App won’t run if you choose lower API than the one target by the App
Select the image and click on Next to continue.
The Final Window is Verify Configuration.
Here you can name your AVD, change startup orientation and few other hardware properties. Click on Show Advanced Settings to show more settings.
Click on Finish to create the AVD.
Managing the AVD
Opening the AVD Manager takes you to the List of AVDS
Running/Stopping the AVD
Under the action column, click on the icon to run the AVD. The Android Emulator uses the AVD to mimic the device. You can then use the control panel to manage the device. The Extend control button at the bottom gives you more options.
In this tutorial, we learned how to create and Manage Android Virtual Devices. In the next tutorial, we will how to create a Simple NativeScript Application