April 19, 2017

Learning Appium Desktop: Setting up Android Emulators with Android Virtual Device Manager, choosing Android operating system version

This is Part 4 of 6. Care to go back to the beginning? Tune in tomorrow to see the next part!

Ever since April 2009, when version 1.5 of the Android mobile operating system was released, the operating systems have been code-named some type of dessert.

Android supports, at the time of this blog post, Android 6.0 (Marshmallow, API Level 23, Released October 5, 2015), Android 7.0 (Nougat, API Level 24, Released August 22, 2016), and Android 7.1.1 (Nougat, API Level 25, October 4, 2016).

We'll be setting up using Android Virtual Device Manager two virtual Android devices.



But what devices should we set up? For that, we can go to the Android Dashboards at https://developer.android.com/about/dashboards/index.html

VersionCodenameAPIDistribution
2.3.3 -
2.3.7
Gingerbread100.9%
4.0.3 -
4.0.4
Ice Cream Sandwich150.9%
4.1.xJelly Bean163.5%
4.2.x175.1%
4.3181.5%
4.4KitKat1920.0%
5.0Lollipop219.0%
5.12223.0%
6.0Marshmallow2331.2%
7.0Nougat244.5%
7.1250.4%
Data collected during a 7-day period ending on April 3, 2017.
Any versions with less than 0.1% distribution are not shown.

... And it looks like with screen sizes, most people seem to be using a Normal screen, hdpi or xhdpi.

Let's remember that when we create two emulated devices.

Android Virtual Device Manager


Dependencies and prerequisites
  • Android Studio 2.0 or higher
  • SDK Tools 25.0.10 or higher
  • adb integration enabled through Android Studio > Tools > Android > Enable ADB Integration

The easiest way to kick this off is through Android Studio:

  • Launch Android Studio
  • Go to Tools -> Android -> AVD Manager

Once we are at the "Your Virtual Devices" homescreen, let's select "Create Virtual Devices".

Randomly picking two emulators, I chose:

  • Nexus S, with 480 x 800 resolution, to capture the hdpi screen type. 
  • Galaxy Nexus, with 720 x 1280 resolution, to capture the xhdpi screen type. 

When selecting Operating Systems, let's choose the updated version of Nougat, and the updated version of Marshmallow to start. Later on, it would be wise to also test on Lollipop, since so many seem to be still using that Android operating system version.

I needed to download the older versions of Marshmallow, and Lollipop. They were installed by default in ~/Library/Android/sdk.

Nexus S, I paired with Marshmallow, Android 6.0, and gave it an AVD Name of Nexus S Marshmallow.
Galaxy Nexus, I paired with Nougat, Android 7.1.1, and dubbed it Galaxy Nexus Nougat.

Need more help? See Developer.Android's section on Create and Manage Virtual Devices at https://developer.android.com/studio/run/managing-avds.html

If you go to the Mac Terminal, you will see if you type: emulator -list-avds

Galaxy_Nexus_Nougat
Nexus_S_Marshmallow

Now, we can go back to the AVD Manager, and launch the Nexus_S_Marshmallow.














Going to the Mac Terminal and running: adb devices

List of devices attached
emulator-5554   device

So, now we have two emulators set up for testing, with one of them running!


Happy Testing!

-T.J. Maher
Twitter | LinkedIn | GitHub

// Sr. QA Engineer, Software Engineer in Test, Software Tester since 1996.
// Contributing Writer for TechBeacon.
// "Looking to move away from manual QA? Follow Adventures in Automation on Facebook!"