Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting ANDROID_HOME enviromental variable on Mac OS X

Could anybody post a working solution for setting ANDROID_HOME via the terminal?

My path to the Android-SDK is /Applications/ADT/sdk.

like image 530
Jacek Kwiecień Avatar asked Nov 14 '13 19:11

Jacek Kwiecień


People also ask

What is Android_home path?

Variable name: ANDROID_HOME , Variable value: the path where you installed the android SDK, in my case is, C:\Android\android-sdk . You have to add the variable to the Path variable system by adding this: ;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools; .

How do I find my Android path on Mac?

If Android Studio shows you the path /Users/<name>/Library/Android/sdk but you can not find it in your folder, just right-click and select "Show View Option". There you will be able to select "Show Library Folder"; select it and you can access the SDK.


2 Answers

Where the Android-SDK is installed depends on how you installed it.

  1. 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).

  2. 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}

  3. 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

  1. Type - echo $ANDROID_HOME to check if the home is set.

echo $ANDROID_HOME

like image 145
user2993582 Avatar answered Nov 13 '22 08:11

user2993582


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 
like image 40
David Douglas Avatar answered Nov 13 '22 08:11

David Douglas