Skip to content

Instantly share code, notes, and snippets.

@ericaroy
Last active August 26, 2024 00:35
Show Gist options
  • Save ericaroy/d08a846daeebe145d2ef to your computer and use it in GitHub Desktop.
Save ericaroy/d08a846daeebe145d2ef to your computer and use it in GitHub Desktop.
Setting Android Home on Mac
Note for me to remember how to set Android Home on Mac
Open Terminal and type in..
nano ~/.bash_profile
Add the below paths
The path should be where your android installation is located
export ANDROID_HOME=/Users/username/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Save file and type in terminal...
source ~/.bash_profile
Check to see if it is set: echo $ANDROID_HOME
Also, you could run into problems with JAVA_HOME not being set..
Find the location of java home and add to bash profile as above
@wackyapps
Copy link

Much much thanks

@buryni
Copy link

buryni commented Dec 6, 2017

Thanks!! :)

@deborah-ufw
Copy link

note to others - "export export" should be just "export" :)

@jcollum
Copy link

jcollum commented Mar 8, 2018

I was wondering about that deborah @ericaroy you should fix that

@TheGreatAndrew
Copy link

TheGreatAndrew commented Apr 11, 2018

I see, the reason why mine does not work cause I follow this: https://facebook.github.io/react-native/docs/getting-started.html
Which lacks a little bit documentation to setup ANDROID_HOME
And does not mention how to set JAVA_HOME

@dorman99
Copy link

i dont have any Android folder in my library, any one can help ?

Copy link

ghost commented May 15, 2018

@dorman99 Are you sure youre looking into the Library folder in your Home folder? and not one on the HardDrive. You can click

Shift + Cmd + .

To see the hidden files in your Home folder and Library should be there

@fegvilela
Copy link

Thanks!!!

@Kunj-Choksi
Copy link

Kunj-Choksi commented Oct 16, 2019

I am facing a weird issue.
I wrote the ANDROID_HOME variable in bash_profile.
Then I hit cmd ‘source ~/.bash_profile ’.
Now echoing my env variables works fine. Until I close the terminal.
It just got vanished if I close the terminal.
To recover, I need to run cmd ‘source ~/.bash_profile ’.

macOS Cataline

@amitrai98
Copy link

@Kunj-Choksi i am facing the same issue every time i have to use source ~/.bash_profile in order to use emulator command

@kingkarki
Copy link

if you are using OS X Catalina .base_profile will not work. Use .zprofile in the root instead.

@zgordan-vv
Copy link

zgordan-vv commented Jun 17, 2020

Thanks, @erikaroy and @kingkarki !

@arundathidm10
Copy link

facing this issue

@arundathidm10
Copy link

Unable to solve the issue

@arundathidm10
Copy link

Android home not set
java home not set
bin directory for java home not set
adb android emulator could not be found because android home or android sdk root is not set

@arundathidm10
Copy link

above solution not helping

@thubamamba
Copy link

This worked great, thank you.

@quangtruongdit
Copy link

quangtruongdit commented Feb 23, 2024

I come here to set ANDROID_HOME but it does not work after update bash_profile.
I found arround, we may need add the config to ~/.zshrc as we did in ~/.bash_profile.
Hope it helps

export ANDROID_HOME=/Users/{your name}/Library/Android/sdk
export ANDROID_TOOLS=/Users/{your name}/Library/Android/sdk/tools/
export ANDROID_PLATFORM_TOOLS=/Users/{your name}/Library/Android/sdk/platform-tools/
export PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS

@leductho911
Copy link

I come here to set ANDROID_HOME but it does not work after update bash_profile. I found arround, we may need add the config to ~/.zshrc as we did in ~/.bash_profile. Hope it helps

export ANDROID_HOME=/Users/{your name}/Library/Android/sdk export ANDROID_TOOLS=/Users/{your name}/Library/Android/sdk/tools/ export ANDROID_PLATFORM_TOOLS=/Users/{your name}/Library/Android/sdk/platform-tools/ export PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS

This works, thanks bro

@leductho911
Copy link

More information:
I added to .zshrc file by these command line:

touch .zshrc
open .zshrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment