Search code examples
androidrubymobilecucumberappium

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


I am getting the below error message:

An unknown server-side error occurred while processing the command. 
Original error: Could not find adb Please set the ANDROID_HOME 
environment variable with the Android SDK root directory path. 
(Selenium::WebDriver::Error::UnknownError)

I have setup all the below:

info AppiumDoctor Appium Doctor v.1.4.2
info AppiumDoctor ### Diagnostic starting ###
info AppiumDoctor  ✔ The Node.js binary was found 
at:/usr/local/bin/node
info AppiumDoctor  ✔ Node version is 7.10.0
info AppiumDoctor  ✔ ANDROID_HOME is set to: 
/Users/shafiq.malik/Library/Android/sdk
info AppiumDoctor  ✔ JAVA_HOME is set to: /Library/Java/Home
info AppiumDoctor  ✔ adb exists at: 
/Users/shafiq.malik/Library/Android/sdk/platform-tools/adb
info AppiumDoctor  ✔ android exists at: 
/Users/shafiq.malik/Library/Android/sdk/tools/android
info AppiumDoctor  ✔ emulator exists at: 
/Users/shafiq.malik/Library/Android/sdk/tools/emulator
info AppiumDoctor  ✔ Bin directory of $JAVA_HOME is set
info AppiumDoctor ### Diagnostic completed, no fix needed. ###
info AppiumDoctor
info AppiumDoctor Everything looks good, bye!
info AppiumDoctor

I am not sure what I am missing. Can somebody please advise?


Solution

  • You need to add the path to the android-sdk to ANDROID_HOME environment variable. e.g. C:\installation-location\android-sdk or /opt/intallation-location/android-sdk

    In Windows 8 & 10:

    1. In Search, search for and then select: System (Control Panel)
    2. Click the Advanced system settings link.
    3. Click Environment Variables. If the ANDROID_HOME environment variable does not exist, click New.
    4. In the Edit System Variable (or New System Variable) window, specify the value of the ANDROID_HOME environment variable. Click OK. Close all remaining windows by clicking OK.

    In Linux:

    1. Edit /etc/environment file.
    2. Append the line export ANDROID_HOME="/opt/intallation-location/android-sdk"
    3. Save the file and then log out and log in.