How do i add android tools to my path on mac?
Solution 1
I just set up a Mac mini for work using the following steps, so I can guarantee this works with a fresh install.
1) Install Android Studio. (Standard is fine, Custom if you want to)
2) Launch Android Studio
3) From the Welcome Screen, click Configure (bottom right corner) > SDK Manager
4) Double check that you have the latest platform tools and tools installed in the SDK Tools tab.
At this point, you will have installed everything related to the android sdk, including the tools, in the default location of /Users/your-user-name/Library/Android/sdk
5) Create a .bash_profile file if you don't already have one at /Users/your-user-name
6) Add the following lines to it: (replace my username with yours)
export PATH=$PATH:/Users/chris.w.newman/Library/Android/sdk/platform-tools
export PATH=$PATH:/Users/chris.w.newman/Library/Android/sdk/tools
export ANDROID_HOME=/Users/chris.w.newman/Library/Android/sdk
By adding it to your .bash_profile, these lines will run every time you use a shell. So you don't have to worry about them ever again.
To test that everything works correctly, try the following 'which' commands from a new shell:
which adb
which android
Since these are added to the path, you should see their file path printed in the shell.
Solution 2
So after checking out this post: Add sdk tools to path in Android Studio app
I tried:
export PATH=/Applications/Android\ Studio.app/sdk/tools:$PATH
and it worked
Mischa
Haven't been writing code for very long, but i'm loving it. At the moment i'm still a student but in a year I will be done and i hope to have some more experience in the field of web development.
Updated on June 24, 2020Comments
-
Mischa almost 4 years
I'm trying to add get the android development environment to work om my mac. I'm following this guide: https://spring.io/guides/gs/android/
I'm supposed to add the sdk to my path using:
export ANDROID_HOME=/Users/myname/Library/Android/sdk/android-sdk-macosx export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
however this does not give me acces to the 'android' command in the termial and when I execute $ANDROID_HOME i keep getting:
zsh: no such file or directory: /Users/myname/Library/Android/sdk/android-sdk-macosx
I've checked the path in
Android Studio>Preferences>Appearance & Behavior>System Settings>Android SDK
SDK location should be correct. What am I doing wrong?
-
Zac Smith over 7 yearsThis is a good explanation, though I kept having to do it on every power on, so I used this link by Ashish (5th one down) on creating a .bash_profile and used the 3 statements from #6 and it has worked great.
-
Sergii over 6 yearsPlease note that you will need to go for another bash configuration file in case if you are using
zsh
. More details github.com/robbyrussell/oh-my-zsh/issues/3807 -
Harry over 6 yearsA little bit smaller would be:
export ANDROID_HOME=/Users/username/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
-
HKoncept over 6 years@Harry For version 3.+ must remove the /sdk in the ANDROID_HOME export
-
HKoncept over 6 yearsWorks only with version 2.+, path are modified in 3+ (see @Harry comment)