In my new MacBook, I installed latest Android Studio. Then, in terminal, I created the .bash_profile, and added following lines to the file:
export ANDROID_HOME=~/Library/Android/sdk
export ANDROID_TOOLS=$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform_tools
export PATH=$PATH:$ANDROID_TOOLS
After that, I run command source .bash_profile
, then I type adb
command, but get error that adb is not recognized as a command. Why? I also echo $PATH
, I saw the platform_tools
directory of Android sdk is there & there is adb file under that directory.
====== UPDATE =====
It is interesting, if I do following, it works:
export PATH=$PATH:/Users/myname/Library/Android/sdk/platform-tools
export PATH=$PATH:/Users/myname/Library/Android/sdk/tools
export ANDROID_HOME=/Users/myname/Library/Android/sdk
WHY? Isn't ~
above identical to /Users/myname
? Why my original script doesn't work but the above one works? I don't understand....Please someone explain to me.
find ~ -name 'adb*'
. Also, you should exportANDROID_SDK_ROOT
andANDROID_NDK_ROOT
. According to the NDK team, the Android tools use the variables to find things. There's also aANDROID_SDK_HOME
discussed in some questions, but its not documented. I still have not seen a canonical reference for it. Finally,ANDROID_HOME
looks incorrect. Usually its something like~/.android
. It does not point to the SDK directory.platform_tools
vsplatform-tools