I've followed the instructions here to install android studio and the android sdk.
I've added the following lines to ~/.bash_profile, and I've run source ~/.bash_profile.
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
The path is correct, I've checked it in Android Studio > Preferences > System Settings > Android SDK.
What is the problem? When I run source ~/.bash_profile, and then echo $ANDROID_HOME, I get some output. But if I close the terminal and restart it, and then I run echo $ANDROID_HOME, I get no output.
If found similar questions here and on other websites, but nothing seems to work. Editing the export lines, directly executing "export ..." in the terminal instead of bash_profile, ... . It all fails to work.
Anyone some tips to help me out?
Even I am using Mac Catalina 10.15.3. After spending 1 whole week I realized that setting JAVA_HOME, M2_HOME and ANDROID_HOME in ~/.bash_profile won't work in Catalina and it is uncertain.
I had to move all my environment variables path from ~/.bash_profile to ~/.zshrc file
Below is my ~/.zshrc file
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=${JAVA_HOME}:$PATH
export M2_HOME=/usr/local/Cellar/maven/3.6.3_1/libexec
export PATH=${M2_HOME}/bin:$PATH
export ANDROID_HOME=/usr/local/share/android-sdk
export PATH=${ANDROID_HOME}/emulator:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/tools/bin:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
Once you are set. Come out of zshrc by pressing Esc:wq! Close & open the terminal.
source ~/.zshrc
echo $ANDROID_HOME
This should display path to ANDROID_HOME
Hope this helps!
Even i was also using Mac Catalina 10.15
Fix :
Step 1: Open Terminal
Step 2: type the command : nano .zshrc
Step 3: Add environment variable
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
Step 4: Save and quit or (control+o) , Enter + Control+x
Step 5: Restart Terminal
Now reverify with echo $ANDROID_HOME it will show path /Users/****/Library/Android/sdk
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With