Setting environmental variables for Android development in Mac OSX

Setting environmental variables or paths to Android SDK tools in ~/.bash_profile sounds so simple ! But its not quite standard when it comes to Mac OSX. In linux, you can simply use export command in ~/.bash_profile and your're done. But in Mac OSX, you have couple of options like bash.rc, bash_profile, /etc/profile and environment.plist etc. I was so confused when all I wanted was to simply have a environmental variable for ANDROID_HOME and want to access SDK tools like android and adb from commandline. So, all I had to do was:

  1. Open Terminal
  2. Type vi ~/.bash_profile in command line. It creates it, if its already not there
  3. Type following in vi editor:
export PATH=$PATH:/Users/PTyagi/Developer/android/sdks/android-sdk-macosx/tools:/Users/PTyagi/Developer/android/sdks/android-sdk-macosx/platform-tools

export ANDROID_HOME=/Users/PTyagi/Developer/android/sdks/android-sdk-macosx
Close the Terminal session and open new one and try echo $ANDROID_HOME to check. It should print the path to SDK home.

2 comments:

  1. Please share the steps to Setting environmental variables for Android development in Windows 7.

    ReplyDelete

Scheduling Repeating Local Notifications using Alarm Manager

Learn about Scheduling Repeating Local Notifications using Alarm Manager in this post .