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