Victor Leung
Victor Leung
BlogAI SolutionAlphaAlgoFlower shopFX CombineIEESushi ClassifierWealth Agile

Note on Ionic framework: Android platform in OS X

February 20, 2015

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: https://developer.android.com/sdk/installing/index.html

Step 2: Unzip the file

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

    /Users/Victor/Workspace/android-sdk-macosx

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
  1. Set the ANDROID HOME value in the .bash_profile
   echo "export ANDROID_HOME=/Users/Victor/Workspace/android-sdk-macosx" >> /Users/Victor/.bash_profile
  1. Alter the PATH value a bit as well
   echo "export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools" >> /Users/Victor/.bash_profile
  1. 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

    android

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☺


About Victor Leung

Software development professional with expertise in application architecture, cloud solutions deployment, and financial products development. Possess a Master's degree in Computer Science and an MBA in Finance. Highly skilled in AWS (Certified Solutions Architect, Developer and SysOps Administrator), GCP (Professional Cloud Architect), Microsoft Azure, Kubernetes(CKA, CKAD, CKS, KCNA), and Scrum(PSM, PSPO) methodologies.

Happy to connect
LinkedIn
Github
Twitter
@victorleungtw

Continuous improvement

Copyright © victorleungtw.com 2023.