Failed to find 'ANDROID_HOME' environment variable


I am trying to build an ionic-android project and i have android sdk installed.

SDK manager installed packages

The name of my project is myApp.I have successfully added android platform to myApp. But when i tries to build the project

~/myApp$ sudo ionic build android

result is

Running command: /home/hari/myApp/hooks/after_prepare/010_add_platform_class.js /home/hari/myApp
  add to body class: platform-android
  ERROR building one of the platforms: Failed to find 'ANDROID_HOME'  environment variable. Try setting setting it manually.
  Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
You may not have the required environment or OS to build this project
Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.

see the ANDROID_HOME and PATH variable


echo $PATH

I have seen almost the same kind of questions on stack overflow, but none works for me. Is there anything wrong with my android-sdk configuration? How can i build this project?


You may want to confirm that your development environment has been set correctly.

Quoting from

Set up the Android development environment

Before you can build Android applications, you must install the
Android SDK. Installing the Android SDK also installs the AVD Manager,
a graphical user interface for creating and managing Android Virtual
Devices (AVDs).

  1. From the Android web site, download the
    correct version of the Android SDK for your operating system.

  2. Unzip the archive to a location of your choosing. For example, on Linux or Mac, you can place it in the root of your user directory. See
    the Android

    web site for additional installation details.

  3. Configure the ANDROID_HOME environment variable based on the location of the Android SDK. Additionally, consider adding
    ANDROID_HOME/tools, and ANDROID_HOME/platform-tools to your PATH.

Mac OS X

export ANDROID_HOME=/<installation location>/android-sdk-macosx
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools


export ANDROID_HOME=/<installation location>/android-sdk-linux
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools


set ANDROID_HOME=C:\<installation location>\android-sdk-windows
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

The Android SDK download does not include specific Android platforms.
To run the code in this guide, you need to download and install the
latest SDK platform. You do this by using the Android SDK and AVD
Manager that you installed in the previous section.

  1. Open the Android SDK Manager window:


    Note: If this command does not open the Android SDK Manager,
    then your path is not configured correctly.

  2. Select the Tools checkbox.

  3. Select the checkbox for the latest Android SDK.

  4. From the Extras folder, select the checkbox for the Android Support Library.

  5. Click the Install packages… button to complete the download and installation.

    Note: You may want to install all the available updates, but be
    aware it will take longer, as each API level is a large download.

Answered By – Brad W

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published