Wednesday, February 11, 2015

[Mac OS] [Android SDK] [Ionic] [How to Fix] ionic platform add android - ANDROID_HOME is not set and "android" command not in your PATH.

  1. Download Android SDK & Unzip it
  2. Setup Environment Path
    • Open terminal, run 'vi ~/.bash_profile'
    • Add the following lines in that file
      • export ANDROID_HOME=/Users/Ian/Documents/Dev/android-sdk-macosx
      • export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
    • Save & Exit
    • Run 'source ~/.bash_profile'
  3. Make sure you have the write permission for the sdk folder.
    • Run 'chmod -R 777 <Your sdk path> 
      • (e.g. chmod -R 777 /Users/xxx/Development/android_sdk_mac).
    • This is really important. I have spent a lot of time figuring this out. If you don't have the write permission, ionic will always throw 'ANDROID_HOME is not set and "android" command not in your PATH' error even if you have correctly set up all the environment variables and path.

No comments:

Post a Comment