• Skip to main content
  • Skip to primary sidebar

AutomationTestingHub

Selenium, Appium, Cucumber and more !!!

Setup Android Environment Variables

May 28, 2018 by anish 41 Comments

This article will provide you with a detailed guide to setup Android Environment variables. This article is a continuation of our previous articles on Android, where you learned how to download and install Android Studio bundle and then how to install additional Android SDK tools.

The main Android environment variables that you would have to set are ANDROID_HOME and Path variables. If you have followed our Appium Tutorial series from the beginning, then you would remember that this article is similar to our previous article where we setup Java environment variables. Let’s now start with the setup process.

Find the folder location where you installed Android SDK

In the first step we will try to find the folder path where we have installed Android SDK –

1. The default folder location where Android SDK is installed is – C:\Users\Anish\AppData\Local\Android\sdk. Please open this folder path and see if you have Android SDK folder in there with contents as shown below

Android Environment Variables - Android SDK folder contents

Please note that if you try to open this folder location by going to each folder one by one (i.e. C > Users > YourUserName and so on… ), then you might not see the AppData folder as its a hidden folder. So, you will have to make hidden folders visible first

2. Copy the SDK folder location once you find it. For us, this folder location is – C:\Users\Anish\AppData\Local\Android\sdk

Setup Android Environment Variables – Setup ANDROID_HOME

Follow the steps given below to setup ANDROID_HOME environment variable –

1. Click on Start menu. Then right click on Computer and select Properties option

Open Computer - Properties

2. This would open the System Properties window as shown below. Now from the Advanced Tab, click on Environment Variables button

System Properties - Advanced Tab

3. From the Environment Variables window, click on New button from System variables section

Environment Properties - System Variables

4. Enter ANDROID_HOME in Variable Name field and SDK folder location (C:\Users\Anish\AppData\Local\Android\sdk) in Variable value field as shown in below image (Please enter the correct folder location that you have in your machine)

Set Android Home Environment Variable

5. Click on OK button. ANDROID_HOME variable will now be added to System variables

ANDROID_HOME added to System Variable

With this, we have successfully added ANDROID_HOME variable. Let us now see how to add the Path variable.

Folder locations to be added to Path variable

In Android SDK folder, there are three specific folders that you need to add to the Path variable. These folders are –

  • platforms-tools folder which has path – C:\Users\Anish\AppData\Local\Android\sdk\platform-tools
  • tools folder which has path – C:\Users\Anish\AppData\Local\Android\sdk\tools
  • bin folder inside tools folder with path – C:\Users\Anish\AppData\Local\Android\sdk\tools\bin

Folders to be added to Path variable

Since we have already added ANDROID_HOME in System variables and its represented by – C:\Users\Anish\AppData\Local\Android\sdk, hence all these above three folder locations can be written as –

  • %ANDROID_HOME%\platform-tools
  • %ANDROID_HOME%\tools
  • %ANDROID_HOME%\tools\bin

Let us now add all these three folder locations in Path variable.

Setup Path Variable

Follow the steps given below to setup Path variable –

1. In the Environment variables window, check that there is a variable called Path under System variables

Android Environment Variables - Path Variable

2. Select the Path variable and click on Edit button. Path variable window would be opened

3. Move over to the end in the Variable value text field. Put a semicolon (;) at the end and start adding all the 3 folder paths separated by semicolon (Semicolon acts as a delimiter between different folder locations added in the Path variable). You should have added all the 3 folder locations as this – ;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;%ANDROID_HOME%\tools\bin

Setup Android Environment Variables - Modifying Path Variables

4. Click on OK button. All the three variables would now be added to the Path variables.

5. Close the Environment variable window by clicking on Ok button. With this, we have now successfully setup Path variable as well

Verify that Android Environment Variables have been set correctly

To verify that all the Android Environment Variables are correctly setup, open command prompt and run this command: sdkmanager – -list (please note that there should be no space between the 2 hyphens, as shown in the below image). This would list down all the installed and available packages which would look a bit like something as shown below (please wait for 3-5 seconds for the list to be displayed)

sdkmanager --list command

You can also run this command: uiautomatorviewer in command prompt. This will open UI Automator Viewer window as displayed below.

UI Automator Window

You can now close UI Automator Window and the command prompt. Both the above commands verify that the Android Environment Variables have been setup correctly. If you face any issues with any of the steps, or if you get any different output using these commands, then please let us know using the comments section. With this we complete our article series on installing Android and setting up Android environment variables. We will now move over to our next article, which is downloading and installing Appium Desktop client.

Next Article: Download and Install Appium Desktop App

Filed Under: Android, Appium

Primary Sidebar

Automation Testing Hub

Tutorials Guide

Write test scripts in BDD format using our Cucumber Selenium Tutorial

Use our Appium Tutorial Series to setup Appium from scratch

Categories

  • Android
  • Appium
  • Cucumber
  • Java
  • Playwright
  • Selenium
  • Tosca

Recent Posts

  • Appium Inspector – Download and Install
  • How to download Chromedriver for Selenium
  • Run Playwright tests on different browsers
  • Playwright Automation Testing Tutorial
  • Selenium IDE Chrome Download

Recent Comments

  • Run Playwright tests on different browsers - AutomationTestingHub on Playwright Automation Testing Tutorial
  • Confluence: CPSSoft Test Framework on Appium Inspector – Download and Install
  • Playwright Automation Testing Tutorial - AutomationTestingHub on Download and Install – Node.js and NPM
  • Chrome浏览器在使用Java的Appium中无法启动。 | JAVA语言的经验与见解 on 2 Ways to find appPackage and appActivity name of your App
  • Appium Inspector Tutorial - AutomationTestingHub on Download and Install Appium 2 Server

Archives

  • January 2024
  • July 2023
  • March 2023
  • February 2023
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • January 2018
  • November 2017
  • October 2017
  • September 2017
  • August 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • November 2016
  • October 2016
  • September 2016
  • August 2016
  • July 2016
  • June 2016

Latest Selenium 3 Guide

Are you using the latest version of Selenium WebDriver? It provides lot better support for the latest browser versions. Check it out here - Setup Latest Selenium WebDriver

Categories

  • Android
  • Appium
  • Cucumber
  • Java
  • Playwright
  • Selenium
  • Tosca

Copyright © 2025 · Genesis Sample on Genesis Framework · WordPress · Log in

Go to mobile version