I set the ANDROID_HOME in .bash_profile and run source ~/.bash profile but after close and open the terminal back then run echo $ANDROID_HOME return blank


source ~/.bash_profile
export PATH="/usr/local/opt/openssl/bin:$PATH"
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
export ANDROID_HOME=/Users/Najibah/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platfrom-tools

This happened when I run echo $ANDROID_HOME

2 Answers

TheGamer007 On Best Solutions

Remove source ~/.bash_profile from the .bash_profile file, because it leads to a loop. You only need to run the command from the terminal in order to load an updated version of the file. New terminal windows will use the latest version of the file anyway.

After changing the .bash_profile, run source ~/.bash_profile from your terminal window, and then run echo $ANDROID_HOME. You should get the expected value.

Touhidul Islam On

Directory should be wrapped in double quotes.

Change JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home like this JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home"