Once the Project has been successfully built, we just have to select the Target device to verify how our Android Project is working. We can select either the connected device or the virtual device as the deployment targets to see the behavior of our Project on the selected devices. Initially, before we move the Project to live, we mostly test the Project on Virtual Devices. Through this article, I will go through how to Create New Virtual Device which is suitable for the Android Project.
We have successfully built our Project through the previous Article “Android Studio : Create Android Project“. I am going to refer to the same settings used in our Project in this Article. I recommend you go through the Article before start reading this.
Below are the steps to create a virtual device:
Select AVD Manager
Step 1. Open Android Studio. Click on the Tools menu and then select AVD Manager. Android Studio will open, ‘Android Virtual Device Manager’ dialog. Assuming, none of the virtual devices are created already.
Virtual Device Configuration
Step 2. Click on the “+ Create Virtual Device…“, button from the ‘Android Virtual Device Manager’ window. Android Studio will open, ‘Virtual Device Configuration‘ wizard; allows you to choose a device definition from the ‘Select Hardware‘ wizard window.
Step 3. The device definition should be related to the Project you created. In our previous Article “Android Studio : Create Android Project“, we have created a Project, for Phone Android devices. Select Phone from the “Category“; then you will see the list of device definitions populated. Select the device definition which suits your Project; that means, which suits your Targeted device. Click on the Next button to move to the ‘System Image’ wizard.
Note that, for our Project, I have chosen, “Pixel 2” (Density: 420dpi) device definition.
Step 4. From the ‘System Image’ wizard, you need to select a system image (Android Operating System image), would like to run on the Virtual Device you are creating. This depends on the installed Android SDK & API level on your System. If the related SDK is not already installed, it will show the link to download the image. Click on the Next button to go to the ‘Android Virtual Device (AVD)’ wizard.
Note that, I have selected API28 because it was installed on my System.
Step 5. ‘Android Virtual Device (AVD)’ wizard, allows you to verify the selected configuration and allows you to change the Emulated Performance. This is a very important step when you are creating Android Virtual Devices.
For the Virtual Devices, you must have to select the hardware acceleration. For this related supported software should be installed on your System.
- Verify whether “Android Emulator” is installed.
- Verify whether “Intel x86 Emulator Accelerator (HAXM installer)” is installed.
There you can verify from Android SDK -> SDK Tools under “System Setting” in Android Manager, If these are not installed, install them to Successfully Run the Project.
Select Hardware Acceleration
On the ‘Android Virtual Device (AVD)’ wizard, the important selection is to select Hardware acceleration by selecting ‘Hardware‘ from the “Graphics:” field which is under the “Emulated Performance” group. Without the hardware emulation selection, your Virtual Device may not Run to run the Projects.
Step 6. Once done the changes, click on the Finish button. Now you will see the Virtual Device you created in the ‘Android Device Manager’ window.
Now we are all set to Run the Android Project. I will explain more about Run a Project in my next Article.
Please give the feedback through the below Comments.
[..] David
One thought on “Android Studio : How to Create New Virtual Device?”