Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i add android tools to my path on mac? [duplicate]

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?

like image 399
Mischa Avatar asked Jun 21 '16 11:06

Mischa


People also ask

How do I find my Android path on Mac?

To determine where the Android SDK folder on your computer is located open Android Studio. Press the Android Studio menu in the toolbar and search for “Android SDK” or navigate there via Appearance & Behavior, System Settings, Android SDK.


1 Answers

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.

like image 199
Chris Newman Avatar answered Oct 06 '22 00:10

Chris Newman