17

I wanted to use the aapt command on a Mac with the android sdk (folder /build-tools/24.0.1). But whenever I try to use the command I get the message that the command is not found (aapt/aapt2). This doesn't work neither in the Terminal nor in Android Studio.

If I list the available commands in the 24.0.1. folder in the Terminal, there is a star sign next to both commands, which is described as:

A star (*) next to a name means that the command is disabled.

How can I enable these commands again? Updating the build-tools didn't help.

josedlujan
  • 5,357
  • 2
  • 27
  • 49
Eve
  • 1,153
  • 1
  • 15
  • 34

2 Answers2

50

Check your path and check if it is correct.

Just edit your ~/.bash_profile add this line:

export PATH=$PATH:/PATH/TO/android-sdk-macosx/build-tools/x.x.x
josedlujan
  • 5,357
  • 2
  • 27
  • 49
  • Thank you, I will try that and write if it worked or not as soon as possible – Eve Sep 29 '16 at 15:47
  • Thank you! I would just like to highlight that in my case, I had to invalidate cache/restart before running the aapt command once again. – Guimo Jan 14 '19 at 12:11
8

Base on @josedlujan answer, here is a quick steps to make aapt command work on Mac

# First, run this to see all available build-tools version
ls ~/Library/Android/sdk/build-tools

# Then open file
nano ~/.zshrc 

# Add this line to the file and save
export PATH=$PATH:~/Library/Android/sdk/build-tools/<version>

## Run
source ~/.zshrc
Linh
  • 57,942
  • 23
  • 262
  • 279