0
votes

Here is my code. I am a beginner to Appium and I am using Java version 13 and latest version of Eclipse and Appium and I have tried everything but everytime I am getting below exception:

FAILED: run org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output. Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48' System info: host: 'LAPTOP-044PA886', ip: '192.168.86.221', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '13' Driver info: driver.version: AndroidDriver remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output. at getResponseForW3CError (C:\Users\Team Quality\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:826:9) at asyncHandler (C:\Users\Team Quality\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:388:37) Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'

Here is my code:

    public static void run() throws MalformedURLException {
        // TODO Auto-generated method stub


        //System.setProperty("webdriver.chrome.driver", "C:\\Users\\Team Quality\\Downloads\\chromedriver_win32\\chromedriver.exe");
        //WebDriver driver = new ChromeDriver();
//      driver.get("http:\\www.easports.com");

        DesiredCapabilities cap = new DesiredCapabilities();
        cap.setCapability(MobileCapabilityType.DEVICE_NAME, "818cec5");
        cap.setCapability("platformName","Android");

        cap.setCapability("appPackage", "com.xxx");
        cap.setCapability("appActivity","com.xxx.xxx.activities.SplashActivity");

        System.out.println("code executed till here");


        cap.setCapability(MobileCapabilityType.APP, "C:\\Users\\Team Quality\\eclipse-workspace\\Intro\\src\\tkstage.apk");

        System.out.println("code executed till here2");
        //AndroidDriver<AndroidElement> driver =new AndroidDriver<AndroidElement> (new URL("http://localhost:4723/wd/hub"),cap);
        //driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap);
        //driver.get("http://appium.io/");

        try {
            AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), cap);

    } catch (MalformedURLException e) {
        System.out.println(e.getMessage());
    }

        System.out.println("code executed till here3");
    }
2
Not sure with the following capability: MobileCapabilityType.DEVICE_NAME, "818cec5", it looks like UDID.frianH

2 Answers

0
votes

Have you installed that application on your device? if not, provide app capability with path to your .apk file. Check your appPackage and appActivity capabilities once again. You can use Apk Analyzer application to ensure that your values are correct

0
votes

Is your appPackage and appActivity correct? You can do a adb shell to check it