Search code examples
seleniumselenium-webdriverappium

Appium error using real android device


I am getting error in the appium. It is working fine in the emulator but not in the device. Please refer the code and error log below. Could anyone let me know the reason for the error.

//Code///////////////////////////////////////
public void setUp() throws Exception{
File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "/app");
File app = new File(appDir, "app.apk");

DesiredCapabilities capabilities = new DesiredCapabilities();

capabilities.setCapability("browserName", "");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("deviceName", "SCH-I535");

capabilities.setCapability("appPackage", "com.app");
capabilities.setCapability("appActivity", "com.justwink.homepage.HomePageActivity");
capabilities.setCapability("appWaitActivity",          "com.app.homepage.HomePageActivity");


try {
    driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);       
} catch (Exception e) {
    e.printStackTrace();
}

driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
}

Solution

  • I fixed it by changing the appActivity name. Orginally I used hierarchy viewer to find the activity name. When I used the command aapt dump badging sample.apk it showed the original activity name.