How to Test Android App on Emulator and setting up Android Virtual Device in New Android Studio
In this article we are going to learn how to set up and configure AVD (Android Virtual Device) and How to test Android App on Emulator. An Android Emulator is simply a software that duplicates the functions of an Android Device. To test Android App on a real device, refer to How to Test Android App using a Real Device discussed in our previous article. Now, let us begin by setting up an Android Virtual Device.
How to set up and Configure Android Virtual Device(AVD) in 5 Simple Steps:
Let us set up ourselves an Android Virtual Device in 5 simple steps.
1. To create an AVD, Click on AVD Manager shown in figure below:
2. Now a window pops up showing the available devices as shown in the image below. Let us create a fresh new Virtual Device. Since we may also need to test our app for a minimum API setting, let us configure for Android Gingerbread With API 10. So Click on ‘Create Virtual Device’.
3. Now select any device category you want. Here, I just selected Phone category, and Nexus 4 Device. Click Next.
4. The window now shows System Images of different APIs. You now select any system Image you want to test the Device. Make sure that you have downloaded the System Image. If not, Hit download link appearing in blue. Select your required System Image and hit Next.
5. The Window now displays verify Configuration settings. You need to be careful in this Setting as it is not configured for all Devices. By Default the System Image uses around 1500 MB of RAM! As this may result in the sluggish response of the system, for those who have less config pc,you may need to modify this amount of RAM used by the Emulator. So, click on ‘Show Advanced Settings’. There you can see the configurations allocated for the Virtual Device which is being created. Now modify the amount of RAM around ~ 500 MB.
You can also customize any other settings like Enabling or disabling Keyboard settings, Camera settings,etc.. Also Check Mark the ‘Store a Snapshot for faster Start up’ so that your Emulator or Virtual Device will Start up fast when you restart it again for testing app. Now click Finish.
Now you can see a new Virtual Device in AVD Manager Menu.
Test Android App on Emulator using newly created AVD:
1. Select the app project to be tested in Project Explorer. Here I am selecting the basic Hello World Project Created in our First article. Click Run.
Now your App Project will run on the New AVD we just Created!