After you installed android studio, you still need to configure some android SDK environment variables then you can use it easily. This article will tell you how to correctly configure SDK environment variable such as ANDROID_HOME, PATH etc.
1. Configure Android SDK Variable In Windows.
1.1 Get Android SDK Install Directory Path.
Before you can configure it, you should first get the android sdk install directory follow below steps.
- Open android studio, click File —> Settings menu item in the top men bar.
- Expand Appearance & Behavior —> System Settings —> Android SDK menu item in left panel of the popup window. Then you can find the Android SDK Location directory path in right panel, remember it.
1.2 Set %ANDROID_HOME% and %Path% System Environment Variable.
- Right click the computer icon in windows file explorer left panel, click Properties menu item in the popup menu list. This will open the windows system configuration window.
- Click Advanced system settings in left panel, it will popup System Properties window, click Environment Variables button to open Environment Variables window.
- Click New… button to add a new system variable, input ANDROID_HOME as variable name and the android sdk location directory path ( such as C:\Users\Administrator\AppData\Local\Android\Sdk ) as variable value.
- Select variable Path and click Edit button and add ;%ANDROID_HOME%\tools;%ANDROID_HOME%\tools\bin;%ANDROID_HOME%\platform-tools at the end of it’s value. Please note the ; must be English character otherwise it will not take effect.
- Click OK and close the system environment variables settings window, open a dos window, type command adb in it. If you see output like below that means the android sdk path variable has been configured successfully.
C:\Users\Administrator>adb Android Debug Bridge version 1.0.39 Version 0.0.1-4500957 Installed as C:\Users\Administrator\AppData\Local\Android\Sdk\platform-tools\adb .exe
2. Configure Android SDK Variable In MacOS.
- Similar with windows, get the android sdk installation directory path in android studio. Generally the android sdk is installed in /Users/user-name/Library/Android/sdk folder in Mac OS.
- Use nano to create or edit user bash profile in user home directory.
$ nano .bash_profile.
- Add ANDROID_HOME and PATH environment variable in user bash profile.
export ANDROID_HOME=/Users/Jerry/Library/Android/sdk export PATH=$PATH:$ANDROID_HOME/tools export PATH=$PATH:$ANDROID_HOME/tools/bin export PATH=$PATH/:$ANDROID_HOME/platform-tools
- Make the added system environment take effect.
$ source .bash_profile
- Now open a terminal and run adb, you should also see something output like in windows.
Permalink
Just wanna admit that this is very helpful, Thanks for taking your time to write this.
Permalink
This page is so helpful. After 48 years, I just solved the error 🙂
Permalink
thanks
Permalink
Configure Android SDK Variable In MacOS.
Added path configuration, now ‘adb’ is up & running.
Great job in sharing it.
Permalink
Thanks for sharing commands to add Android Studio to mac os x path environment variables; at least ‘adb’ is up and running.
Permalink
in the terminal window do this.
1. Open command prompt
2.
> echo export “ANDROID_SDK=/Users//Library/Android/sdk” >> ~/.bash_profile
Thats’s it.
3.
Close your terminal.
4.
Open it again.
5. Type – echo $ANDROID_HOME to check if the home is set.