HOW TO SET ANDROID ENVIRONMENTAL VARIABLES ON MACOS
Are you a new apple user? got a Macbook, iMac or any other MacOS device and finding it difficult to setup android environment variables on your machine? well you’ve come the the right blog !
SET UP ANDROID ENVIRONMENT VARIABLES ON MacOS, Macbook, iMac
First make sure that you’ve successfully installed Android Studio from the official website and make sure to install SDKs and Emulators once you are sure that you’ve installed complete android studio setup including the sdks and emulators required, you can follow the further steps below:
FOUR EASY STEPS TO SETUP ANDROID STUDIO ENVIRONMENT IN YOUR MAC
- Open your ANDROID STUDIO & click on “Configure” drop-down menu. (At the bottom right corner of android studio).
- Open “SDK Manager” from the drop-down.
- From SDK manager you will be able to read and copy the location where SDKs are installed in your Mac, Note or Copy this location.
- And now edit your configuration file by following the instructions below:
ENVIRONMENTAL VARIABLE CONFIGURATION:
You can edit using nano editor, write command
nano $HOME/.bashrc , Now you will be able to write into this configuration file.
Add the following lines to your
$HOME/.bashrc (if you are using zsh then ~/.zprofile or ~/.zshrc) config file:
export ANDROID_HOME=$HOME/Library/Android/sdk export PATH=$PATH:$ANDROID_HOME/emulator export PATH=$PATH:$ANDROID_HOME/platform-tools export PATH=$PATH:$ANDROID_HOME/tools export PATH=$PATH:$ANDROID_HOME/tools/bin
If your Android SDK is not downloaded in the default location then, In this case, you have to replace “
$HOME/Library/Android/sdk” with your original path of android SDK that you copied in step # 5 above.
To save this modified bash-profile file you just have to press
CONTROL + O to save the file using nano editor and then press
ENTER to confirm name and then press
CONTROL + X to exit out of this nano file editor.
Now close your terminal and re-open and then, To confirm that variables are working you can write
adb devices or any other command that works only if the variables are properly set.
If its not working use following command to get your current environment variable for ANDROID_HOME and match it with the location where your sdks are installed:
source ~/.bash_profile echo $ANDROID_HOME
Write the above code in your terminal and you will get the current location of your android_home variable.
That’s all now your environmental variables are permanently setup on your MacOS!
Good Luck! Enjoy hacking with the android studio 😀
STILL CONFUSED OR STUCK SOMEWHERE? WATCH THE VIDEO:-