Note on Ionic framework: Android platform in OS X

February 20, 2015

In this blog post, we are going to walk through a couple of error messages to install dependencies for Android platform of Ionic framework using Mac OS X. Follow this official guide to install Cordova and ionic, then create project until the step to config platform.

We want to enable the Android platform by this command:

ionic platform add android

But you may encounter this error:

Error: ANDROID_HOME is not set and “android” command not in your PATH.

Step 1: Download android-sdk

Go to the android developer website and download stand-alone SDK Tools:

Step 2: Unzip the file

For example, I unzip it to the path of my workspace


Step 3: Set android command in your PATH

Note: replace my name “Victor” below to your name. In case you are using on-my-zsh, replace the command from bash to zsh profile.

  1. In your terminal, make sure we have a newline at the end of the .bash_profile

echo >> /Users/Victor/.bash_profile

2. Set the ANDROID HOME value in the .bash_profile

echo “export ANDROID_HOME=/Users/Victor/Workspace/android-sdk-macosx” >> /Users/Victor/.bash_profile

3. Alter the PATH value a bit as well

echo “export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools” >> /Users/Victor/.bash_profile

4. Tell the terminal to update all the things

. /Users/Victor/.bash_profile

Step 4: Install android-19

Now if you try again to run:

ionic platform add android

You may come up with the following error:

Error: Please install Android target “android-19”.

Run “android” from your command-line to open the SDK manager


Check the box for Android 4.4.2 (API 19). Then click “install 8 packages…”.

Accepted the license. And finger crossed while waiting for the download process.

Finally, try this command again:

ionic platform add android

And boom,

Project successfully created.

Feel free to send me a help request if you couldn’t get it working. Cheers☺

Originally published at on December 22, 2014.

Written by Victor Leung who is a keen traveller to see every country in the world, passionate about cutting edge technologies. Follow me on Twitter