Launching appium server programmatically throws server-side error Could not find 'adb' in PATH

2.2k Views Asked by At

While launch appium server manually this issue doesnt occur.

Error log

org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Could not find 'adb' in PATH. Please set the ANDROID_HOME or ANDROID_SDK_ROOT environment variables to the corect Android SDK root directory path.

Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'INSML-0VLLVCF', ip: 'fe80:0:0:0:c3f:fa48:d75f:bc45%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '1.8.0_251' Driver info: driver.version: AndroidDriver remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not find 'adb' in PATH. Please set the ANDROID_HOME or ANDROID_SDK_ROOT environment variables to the corect Android SDK root directory path. at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9) at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:388:37) Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'INSML-0VLLVCF', ip: 'fe80:0:0:0:c3f:fa48:d75f:bc45%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '1.8.0_251' Driver info: driver.version: AndroidDriver

1

There are 1 best solutions below

3
On

Run which aapt in terminal and check the output. Most likely it is empty.

If you didn't install adb, you can follow these steps

If you install it, then probably you didn't set path properly: run cat ~/.bash_profile and make sure to set path to ANDROID_HOME, assuming you did default path installation

export ANDROID_HOME=/Users/<your_username>/Library/Android/sdk
export PATH=$ANDROID_HOME:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools/bin:$PATH
export PATH=$ANDROID_HOME/build-tools/<sdk_version>:$PATH

You can check official Appium docs about environment issues troubleshoot