Note on Ionic Framework: Android Platform in OS X
In this blog post, we will walk through several error messages that you might encounter when installing dependencies for the Android platform of the Ionic framework on Mac OS X. Follow this official guide to install Cordova and Ionic, and then create a project up until the step where you configure the platform.
To enable the Android platform, run the following command:
However, you may encounter this error:
Step 1: Download the Android SDK
Visit the Android developer website and download the stand-alone SDK Tools: https://developer.android.com/sdk/installing/index.html.
Step 2: Unzip the File
I unzipped the SDK to the path of my workspace:
Step 3: Set the Android Command in Your PATH
Note: Replace "Victor" with your username. If you are using oh-my-zsh, replace the .bash_profile
with your .zshrc
profile.
- Open your terminal and ensure that
.bash_profile
ends with a newline:
- Set the
ANDROID_HOME
environment variable in.bash_profile
:
echo "export ANDROID_HOME=/Users/Victor/Workspace/android-sdk-macosx" >> /Users/Victor/.bash_profile
- Update the PATH variable as well:
echo "export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools" >> /Users/Victor/.bash_profile
- Reload the terminal to apply the changes:
Step 4: Install Android-19
Now, if you try to run:
You might see the following error:
Run android
from your command line to open the SDK manager:
Check the box for Android 4.4.2 (API 19) and then click "Install 8 packages…". Accept the license and keep your fingers crossed while waiting for the download process to complete.
Finally, try running the command again:
And voila:
If you encounter any issues, feel free to send me a help request. Cheers! ☺