Note on Ionic framework: Android platform in OS X

In this blog post, we are going to walk through a couple 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 croessed 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.

By Victor Leung

Experience in software development, consulting services and technical product management. Understanding of business and technology with an MBA in Finance and a Master degree in Computer Science. AWS Certified Solution Architect with experience in building products from scratch and serving as a charismatic leader.

Leave a comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: