Setting ANDROID_HOME enviromental variable on Mac OS X
I am having MAC OS X(Sierra) 10.12.2.
I set ANDROID_HOME to work on React Native(for Android apps) by following the following steps.
Open Terminal (press Command+SpaceBar, type Terminal, Hit ENTER).
Add the following 3 lines to ~/.bash_profile.
export ANDROID_HOME=$HOME/Library/Android/sdk/ export PATH=$PATH:$ANDROID_HOME/tools export PATH=$PATH:$ANDROID_HOME/platform-tools
Finally execute the below command (or RESTART the system to reflect the changes made).
source ~/.bash_profile
That's it.
Where the Android-SDK is installed depends on how you installed it.
If you downloaded the SDK through their website and then dragged/dropped the Application to your Applications folder, it's most likely here:
/Applications/ADT/sdk
(as it is in your case).If you installed the SDK using Homebrew (
brew cask install android-sdk
), then it's located here:/usr/local/Caskroom/android-sdk/{YOUR_SDK_VERSION_NUMBER}
If the SDK was installed automatically as part of Android Studio then it's located here:
/Users/{YOUR_USER_NAME}/Library/Android/sdk
Once you know the location, open a terminal window and enter the following (changing out the path to the SDK to be however you installed it):
export ANDROID_HOME={YOUR_PATH}
Once you have this set, you need to add this to the PATH environment variable:
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Lastly apply these changes by re-sourcing .bash_profile:
source ~/.bash_profile
- Type - echo $ANDROID_HOME to check if the home is set.
echo $ANDROID_HOME
Adding the following to my .bash_profile worked for me:
export ANDROID_HOME=/Users/$USER/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
In Terminal:
nano ~/.bash_profile
Add lines:
export ANDROID_HOME=/YOUR_PATH_TO/android-sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
Check it worked:
source ~/.bash_profile
echo $ANDROID_HOME