Step by step guide to setup Appium for Android - Windows - Part 2

To start writing automated tests for your app, using Appium, we need to do some setup beforehand. We will need the following setup before writing our tests.
This post will be a part of your step by step guide to setup Appium for Android on Windows OS.
We have already seen JDK installation in our previous post. Here we will continue from where we left. We will do the Android SDK installation.

Android Requirements

  • Android SDK API >= 17 (Additional features require 18/19)
  • Appium supports Android on OS X, Linux and Windows.
For the scope of this post, we will consider Appium for Android on Windows

  1. Go to Android developer’s site and download the Stand-alone SDK tools
  2. Android is now officially ending its support for Eclipse ADT plugin, hence we recommend using the stand-alone SDK tools.
  3. Download the compressed zip file.
  4. Create a directly called “Android” in any location that’s easy to remember. Say "C:\Android"
  5. Extract the contents of the downloaded zip file to the new directory you created, "C:\Android"
  6. The Android SDK archive initially contains only the basic SDK tools. It does not contain an Android platform or any third-party libraries.
  7. To get all the necessary tool, double click on “SDK Manager.exe”
  8. Select the packages for the Android version of your choice - I have selected Android 4.4.2 (API 19).
    • SDK Platform 
    • ARM EABI v7a System Image 
    • Intel x86 Atom System Image 
    • Google APIs (System Image).
    These will help us create and run virtual device running Android 4.4.2
  9. Select Android SDK Platform-tools & Android SDK Build-tools (these will add platform-tools folder to your location of SDK content)
  10. Click on Install 6 packages
  11. Accept license and continue downloading/installing the packages.
Once the download is complete, let’s set up the system variables
  • Right-click the My Computer icon on your desktop and select Properties.
  • Click on Advanced systems settings. 
  • Click the Environment Variables button. 
  • Under System Variables, click New.
  • Enter the variable name as ANDROID_HOME.
  • Enter the variable value as the installation path directory where you have all the contents (example - C:\Android) extracted.
  • Click OK.
  • Edit the path variable under “System variables” and enter the path like C:\Android\platform-tools; (change this path according to your installation locations)
  • Click OK/Apply Changes.
To check if the path is properly set up, start your command prompt and type “adb” and hit enter. 

You should see the available adb commands. If you get an error, it means you haven’t set up the path properly in your environment variables.

Now that we have Android SDK installed and configured the paths, it’s time to create a virtual android device (AVD)
AVD Manager:

An Android Virtual Device (AVD) is a device configuration that is run with the Android emulator. It works with the emulator to provide a virtual device-specific environment in which to install and run Android apps.

You can launch the AVD Manager in one of the following ways
  1. From the SDK manager, click on tools > Manage AVDs
  2. From the SDK installation folder, double click the “AVD Manager.exe”
Once you launch AVD Manager, you can create a new virtual device

Click on “Create” and fill in the details for the device you would like to create and click “OK”

A new virtual device will be available in the AVD manager.

Select the device and click on Start and you will see a window to specify Launch options.

Click on “Launch” and you will have your emulator up and running.

To confirm that everything is fine and SDK installation is correct, start you command prompt, type “adb devices” and hit enter.

You should see the emulator you just launched in the list of devices.

You have successfully installed Android SDK as a part of your setup to run appium tests for Android
on Windows.

In the next post we will see the Appium installation guide.

If you like the post or found it useful, don't forget to share it. Feel free to comment and let us know your thoughts.