0

Code:

public class AppDAta {
    public static URL url;
      public static DesiredCapabilities capabilities;
      public static AndroidDriver<AndroidElement> driver;

      //1
      @Test
      public void setupAppium() throws MalformedURLException {
        //2
        final String URL_STRING = "http://127.0.0.1:4723/wd/hub";
        url = new URL("http://127.0.0.1:4723/wd/hub");

        //3
        DesiredCapabilities cap= new DesiredCapabilities();
        cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Nexus_4_API_27");
        cap.setCapability(MobileCapabilityType.PLATFORM_NAME, "android");
        cap.setCapability(MobileCapabilityType.PLATFORM_VERSION, "3.6.0");
        cap.setCapability(MobileCapabilityType.APP, "/Users/uss/Desktop/untitled folder/Appium/src/main/java/Appium/ApiDemos-debug.apk");
        cap.setCapability(MobileCapabilityType.NO_RESET, true);
       // cap.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
        cap.setCapability("useNewWDA", false);
        //4
        AndroidDriver<AndroidElement> driver = new AndroidDriver<AndroidElement>(url, cap);
        driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
        //driver.resetApp();
      }

}

Getting this type of error in console:

FAILED: setupAppium
org.openqa.selenium.WebDriverException: 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.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: 'tests-Mac-mini.local', ip: 'fe80:0:0:0:431:f1c:51d3:566a%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_111'
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.
4
  • The error is pretty self-explainatory. Check your environment variables (run Terminal and use command printenv ) ANDROID_HOME or ANDROID_SDK_ROOT if they are a) set and b) if they point to proper location. I – Prome Nov 22 '19 at 7:50
  • i already set, still getting error. – Krina Modi Nov 22 '19 at 10:11
  • Which OS are you using? – masood ghz Nov 28 '19 at 12:16
  • @masoodghz as stated in the error: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6' – Prome Jan 7 '20 at 11:50
0

As per my experience in the qa services, it appears like required ADB paths are not completely configured on the Mac machine.

So for that, along with the ANDROID_HOME variable, 02 additional paths:

  • pointing to the 'platform-tools' and 'platforms' folder, inside the Android SDK folder also needs to be initialized in the main PATH variable.

Providing below an instance for setting the 02 additional paths on Mac:

export ANDROID_HOME=/Users/user/adt-bundle-mac-x86_64-20130917/sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$PATH:$ANDROID_HOME/platforms

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.