I'm pretty sure that the Android SDK doesn't try to modify your PATH
variable for you. If you want to be able to run SDK tools without specifying their full path, you'll need to add the folder(s) containing them to your PATH
one by one.
You can do this by editing your ~/.bash_profile
and adding a line like so (or editing an existing line like this if you have one already):
export PATH="$PATH:/PATH/TO/android-sdk-macosx/build-tools/17.0.0"
Alternatively, you can just specify the full path to the tool when invoking it, like so:
/PATH/TO/android-sdk-macosx/build-tools/17.0.0/aapt v
I'm not sure this ever happens with aapt
, but this can be useful to disambiguate if multiple versions of a tool are installed. To see which version of a command that bash is resolving to, you can usually find out by running which
, like so:
which aapt
EDIT
There have been a number of good comments on this answer including Jared's excellent suggestion to dynamically add the latest build-tools to the path. I reimplemented his code in pure 3.x bash, here's what's currently in my ~/.bash_profile
. First, make sure to set ANDROID_HOME
:
export ANDROID_HOME="$HOME/Library/Android/sdk" #Set this to the path to your Android SDK if it's not in the default location
Then (if you are using bash):
BUILD_TOOLS=($ANDROID_HOME/build-tools/*)
ANDROID_LATEST_BUILD_TOOLS="${BUILD_TOOLS[@]:(-1)}"
export PATH="$PATH:$HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_LATEST_BUILD_TOOLS"
Alternatively, here is a POSIX version that should work in any shell:
ANDROID_LATEST_BUILD_TOOLS=$(ls -r ${ANDROID_HOME}/build-tools|head -1)
export PATH="$PATH:$HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/$ANDROID_LATEST_BUILD_TOOLS"