Error: Could not find 'aapt' in PATH. Please set the ANDROID_HOME or ANDROID_SDK_ROOT environment variables to the corect Android SDK root directory path

I set up Android_HOME and JAVA_HOME environment in my MAC, but I keep observing the error : Could not find ‘aapt’ in PATH. Please set the ANDROID_HOME or ANDROID_SDK_ROOT environment variables to the corect Android SDK root directory path.
Can you advise what is problem of my set up?

[Environment Variables]

export ANDROID_HOME=/Users/jaehyunan/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform_tools
export PATH=/usr/local/bin
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=${JAVA_HOME}/bin:$PATH

Probably would work on the command line, but I would bet you are using some kind of IDE when you see this error. If that’s so, could you share the IDE you are using that does not read environment variables properly?

Try to run appium-doctor and confirm that the ADB path is proper or not.

When you run appium-doctor you should be able to see similar as below screenshot.

And make sure to set the environment variables in bashrc file & bash_profile also.

Try giving like this:

#ANDROID_HOME
export ANDROID_HOME=/Users/xxxxxx/Library/Android/sdk
PATH="/users/xxxxxx/Library/Android/sdk/tools:${PATH}"
PATH="/Users/xxxxxx/Library/Android/sdk/tools/bin:$PATH}"
PATH="/Users/xxxxxx/Library/Android/sdk/platform-tools:${PATH}"

Now it is working after reboot.

1 Like