0
votes

I am unable to launch the android app in device using APPIUM. Please find my code below :

public static void main(String[] args) throws MalformedURLException {

       File appDir =  new File("src");
       File app = new File(appDir,"Mast_sab.apk");

       DesiredCapabilities cap = new DesiredCapabilities();
       cap.setCapability(MobileCapabilityType.PLATFORM_NAME,MobilePlatform.ANDROID);
       cap.setCapability(MobileCapabilityType.DEVICE_NAME,"071ce659018966d9");
       cap.setCapability(MobileCapabilityType.APP_PACKAGE,"com.sabm.mast");
       cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT,"1000");
       cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
       AndroidDriver driver = new AndroidDriver (new URL("http://127.0.0.1:4723/wd/hub"),cap);


}

I get the following error:

error: Unhandled error: Error: getaddrinfo ENOTFOUND localhost at errnoException (dns.js:44:10) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:94:26) context: [POST /wd/hub/session {"desiredCapabilities":{"appPackage":"com.sabm.mast","app":"/Users/sudhir.pandit/Documents/workspace/Learning/src/Mast_sab.apk","platformName":"Android","deviceName":"071ce659018966d9","newCommandTime]

Please help with this error

2
I am using MAC 10.9.4 Appium version 1.3.7Sudhir Pandit
I am using MAC 10.9.4 and Appium version 1.3.7Sudhir Pandit

2 Answers

4
votes

Please add 127.0.0.1 localhost in your host (private/etc/hosts) file and run the code

0
votes

For Linux users: If you are getting issue again even after adding localhost entry in /etc/hosts, then it might be nscd deamon is not started.