Set ANDROID_HOME and Path Environment Variables For SDK In Windows

ANDROID_HOME : You must need to set android_home environment variable in order to run appium test. In previous post, We learnt about how to download and install android SDK software and its different packages in windows. In order to use android environment to run appium software automation tests, You must need to set ANDROID_HOME and path environment variables for describing path of android SDK folders to your operating system. Bellow given steps will explain you how to set ANDROID_HOME and Path Environment Variables in windows for android SDK software.

PREREQUISITES : FIRST 3 STEPS of appium automation software tutorial should be completed.

Set ANDROID_HOME windows Variable

After installation of different packages, You need to set android_home environment variable and path environment variables. Follow the steps given bellow to set it.
  • Open "Environment Variables" dialog from win start menu -> Right click on My Computer -> Select properties -> Advanced system settings -> Environment Variables button from Advanced tab. You can view detailed steps to open Environment Variables dialog in THIS POST.
  • Click on New button under User Variable table. It will open New User Variable dialog.
  • Set Variable Name = ANDROID_HOME and Variable value = E:\SDK (Path of SDK folder). Path can be different for you as per your SDK folder location as described in previous post.
  • Click on OK button to close New User Variable dialog as shown in bellow image.
ANDROID_HOME

Set Path Variables
  • Open SDK Folder from E: drive.
  • You will find "tools" and "platform-tools" folders inside SDK folder.
  • Copy path of both these folders. e.g. E:\SDK\tools and E:\SDK\platform-tools\
  • Open "Environment Variables" dialog as described above.
  • Locate Path variable line under System Variables table.
  • Edit Path variable by clicking on Edit button. It will open Edit  System Variables dialog.
  • Append "tools" and "platform-tools" folder's full path at the end of line as shown in bellow image. e.g. ;E:\SDK\tools;E:\SDK\platform-tools\;
set ANDROID_HOME

  • Now close all dialog by clicking on OK buttons of all opened dialog as shown in above image.
Verify Android Is Installed And Configured Properly
To check if android is configured properly or not,
  • Open command prompt.
  • Type command android as shown in bellow image.
  • It will open Android SDK Manager dialog as shown in bellow image.
Verify Android Is Installed


That means android is configured properly in your system.

Now android_home environment variable windows and Path Environment Variables are set for android SDK in windows environment. So android environment is configured and ready to use with appium to execute software automation tests. Next post will describe you how to integrate SDK with eclipse using Eclipse ADT Plugin to use android SDK with eclipse.

21 comments:

  1. Thanks for the post its really help full for initial android user

    ReplyDelete
  2. Thank you for your help but i have an issue that is i do not find the sdk path in my computer. I want this setup for an ionic app create android platform and generate apk file. I also installed in my computer android studio.

    Please help me to find the sdk path. I'm getting the error ANDROID_HOME veriable not setup, setup it manually.

    ReplyDelete
    Replies
    1. u have to add JAVA_HOME variable also along with ANDROID_HOME to have proper functionality.

      Delete
    2. u have to add JAVA_HOME variable also along with ANDROID_HOME to have proper functionality.

      Delete
  3. I'm getting ANDROID_HOME variable not setup setup it manually to generate a apk from a ionic framework project. i did not find the sdk path in my computer but i also installed android studio in my computer. Please help me.

    ReplyDelete
    Replies
    1. You are developing project means you are developer and asking for help regarding deploy from a testing background funny.

      I am answering late but hope someone will find it useful :
      If you have already installed android studio then you will find your sdk in user appdata hidden folder.

      Delete
  4. 'android' is not recognised as internal or external command,operable program or batch file- message is displayed in command prompt. I had set the path correctly, But don't know what is the problem can you please help me with it??

    ReplyDelete
    Replies
    1. maybe you have spaces in your path, for example if your sdk in Program files folder...
      you should set the correct path, use such scheme:
      Progra~1 = 'Program Files'
      Progra~2 = 'Program Files(x86)'
      it is for windows x64

      Delete
    2. maybe you have some spaces in your path, for example your sdk is located in "Program files"...
      use such scheme:
      Progra~1 = 'Program Files'
      Progra~2 = 'Program Files(x86)'
      it's for windows x64

      Delete
    3. I have also faced the same error. But once after providing 'SDK path' in the System variables 'Path'. The error is cleared

      Delete
  5. By far the most helpful page I have found about setting up all the variables and paths for android :)

    ReplyDelete
  6. I run the command prompt I got the sdk manager, but I also got "this system cannot find the specified path", let me know what I have to do solve this issue

    ReplyDelete
  7. The "android" command is depercated
    For manual sdk, avd, and project management, please use android studio.
    For command-line tools, use tools\bin\sdk manager.bat
    And tools\bin\avdmanager.bat

    ReplyDelete
    Replies
    1. Same issue, What is the solution for this ?

      Delete
    2. aquĆ­ esta la respuesta al problema https://stackoverflow.com/questions/42638589/android-studio-sdk-manager

      Delete
  8. In the latest version of the Android SDK, running "SDK Manager.exe" and/or "AVD Manager.exe" will not open anymore. Even the "Launch Standalone SDK Manager" link in Android Studio, which can be previously found in Android SDK Settings, is now gone.

    It is now recommended to perform manual SDK and AVD management inside Android Studio. But for those who do not have an Android Studio or for those who do not like to open Android Studio just to perform SDK management, you can still manage the SDK using the command line tools, "tools/bin/sdkmanager.bat" and "tools/bin/avdmanager.bat".

    This information is available when running "tools/android.bat". I think this is true for those who currently have Android SDK tooks v25.3.1 and above.

    https://stackoverflow.com/questions/5199811/android-sdk-manager-wont-open

    ReplyDelete
  9. Thank you, I was having difficulty getting ADB interface to work in PowerShell, but your excellent tutorial fixed that for me!

    ReplyDelete