Could not find adb Please set the ANDROID_HOME environment variable with the Android SDK root directory path

I am working in Mac machine . Configured android sdk and also set paths in ~/.bash_profile file. While running the Appium server I am getting the below error .

Could not find adb Please set the ANDROID_HOME environment variable with the Android SDK root directory path.

Appium Version - 1.7.1

Capabilities :
“platformName”: “Android”,
“platformVersion”: “7.1.1”,
“deviceName”: “xyzzy”,
“app”: “abc.apk”

~/.bash_profile file :

export JAVA_HOME= ---------
export ANDROID_HOME=-------------
export PATH=${JAVA_HOME}/bin
export PATH=${ANDROID_HOME}/build-tools:$PATH
export PATH=${ANDROID_HOME}/tools:$PATH
export PATH=${ANDROID_HOME}/platform-tools:$PATH
set PATH=${PATH}:${JAVA_HOME}/bin

Please help me on this . Can we automate android app using Mac or not ?

Can you run the appium server on console and run your scripts. That should resolve your issue :slight_smile:

Thanks . Can I know u talking about to download Appium through npm and and run Appium in terminal rather than using the Appium desktop ?

1 Like

I’ve verified on the latest GUI of Appium. If $ANDROID_HOME is set properly and added to path, Appium GUI should be able to find it :slight_smile:

Yes. Try installing through npm if GUI doesn’t help you much.

Thanks . I have configured below path in ~/.bash_profile file :

export JAVA_HOME= ---------
export ANDROID_HOME=-------------
export PATH=${JAVA_HOME}/bin
export PATH=${ANDROID_HOME}/build-tools:$PATH
export PATH=${ANDROID_HOME}/tools:$PATH
export PATH=${ANDROID_HOME}/platform-tools:$PATH
set PATH=${PATH}:${JAVA_HOME}/bin

Please guide me if I am doing anything wrong or any changes required in configuration.

Ideally what u have should suffice. Also can u please share the output for $echo $PATH.

/Users/srikantakumar/Desktop/sdk/platform-tools:/Users/srikantakumar/Desktop/sdk/tools:/Users/srikantakumar/Desktop/sdk/build-tools:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/bin

Thanks for the suggestion it workes for me while running the appium server on console . But please help me out to solve the problem for desktop version .

Kindly share the snippet of $cat .bash_profile ? I think ANDROID_HOME isn’t set properly.

Thanks , the issue got resolved after adding to additional path and working fine now.

@srikanta Hi … can you please tell me the solution? which additional path? where to add it?

Please add below two lines in to you ~/.bash_profile file.

export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"

@srikanta I have set the path details in bas_profile as you have mentioned but I am getting the below error while executing from Appium Desktop:
“Encountered internal error running command: Error: Could not find ‘aapt’ in PATH. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.”

bash_profile details:
Upendras-iMac:~ upendra$ cat .bash_profile

export JAVA_HOME=$(/usr/libexec/java_home)

export ANDROID_HOME=/Users/upendra/Library/Android/sdk

export PATH=${ANDROID_HOME}/build-tools:$PATH

export PATH=${ANDROID_HOME}/tools:$PATH

export PATH=${ANDROID_HOME}/platform-tools:$PATH

export PATH=${ANDROID_HOME}/build-tools/29.0.2:$PATH

export PATH=${JAVA_HOME}/bin

export PATH="/usr/bin:/bin:/usr/sbin:/sbin"

export PATH="/usr/local/bin:/usr/local/sbin:$PATH"

set PATH=${PATH}:${JAVA_HOME}/bin

even after adding these two steps, not working for me :frowning: but it is working from command line if I do man test from my workspace after starting the Appium server from the terminal

Yup it worked you save my time , but how i can fix this issue !?
How i can run/stop the appium from desktop App