Training Video - 3 Unable to laun the App, error and code are given below | Appium Training|Appium tutorials

Appium Training Forum

Training Video - 3 Unable to laun the App, error and code are given below

K
Kalyan Post on 11/10/2019

package com.demo;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;

import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;

public class Temp {
	public static AndroidDriver<MobileElement> driver;
	//public static MobileDriver<MobileElement> driver2;
	
	@Test
	public void testApp() throws MalformedURLException, InterruptedException {
		/*
		 * 1. platform 
		 * 2. OS version
		 * 3. Level of App
		 * 4. UDID
		 * 5. DeviceName
		 */
		
		File app = new File("E:\\APKs\\com.zoho.cm_3_apps.evozi.com.apk");
		
		DesiredCapabilities caps = new DesiredCapabilities();
		caps.setCapability("deviceName", "Moto G5s Plus");
		caps.setCapability("udid", "ZY32287N3R");
		caps.setCapability("platformName", "Android");
		caps.setCapability("platformVersion", "8.1.0");
		caps.setCapability("app", app.getAbsolutePath());
		caps.setCapability("noReset", "true");
		
		try {
			driver = new AndroidDriver<MobileElement>(new URL(
					"http://0.0.0.0:4723/wd/hub"), caps);
		} catch (MalformedURLException e) {
			System.out.println(e.getMessage());
		}
		Thread.sleep(3000);
		
		}
	

}


Error from the server:
[info] [35m[Appium][39m Welcome to Appium v1.15.0
[info] [35m[Appium][39m Non-default server args:
[info] [35m[Appium][39m   allowInsecure: {
[info] [35m[Appium][39m   }
[info] [35m[Appium][39m   denyInsecure: {
[info] [35m[Appium][39m   }
[info] [35m[Appium][39m Appium REST http interface listener started on 0.0.0.0:4723[info] [35m[HTTP][39m [37m-->[39m [37mPOST[39m [37m/wd/hub/session[39m
[info] [35m[HTTP][39m [90m{"desiredCapabilities":{"app":"E:\\APKs\\com.zoho.cm_3_apps.evozi.com.apk","noReset":"true","platformVersion":"8.1.0","platformName":"Android","udid":"ZY32287N3R","deviceName":"Moto G5s Plus"},"capabilities":{"firstMatch":[{"appium:app":"E:\\APKs\\com.zoho.cm_3_apps.evozi.com.apk","appium:deviceName":"Moto G5s Plus","appium:noReset":"true","platformName":"android","appium:platformVersion":"8.1.0","appium:udid":"ZY32287N3R"}]}}[39m
[debug] [35m[W3C][39m Calling AppiumDriver.createSession() with args: [{"app":"E:\\APKs\\com.zoho.cm_3_apps.evozi.com.apk","noReset":"true","platformVersion":"8.1.0","platformName":"Android","udid":"ZY32287N3R","deviceName":"Moto G5s Plus"},null,{"firstMatch":[{"appium:app":"E:\\APKs\\com.zoho.cm_3_apps.evozi.com.apk","appium:deviceName":"Moto G5s Plus","appium:noReset":"true","platformName":"android","appium:platformVersion":"8.1.0","appium:udid":"ZY32287N3R"}]}]
[debug] [35m[BaseDriver][39m Event 'newSessionRequested' logged at 1570803722975 (19:52:02 GMT+0530 (India Standard Time))
[warn] [35m[Appium][39m 
[warn] [35m[Appium][39m ======================================================================
[warn] [35m[Appium][39m   DEPRECATION WARNING:
[warn] [35m[Appium][39m 
[warn] [35m[Appium][39m   The 'automationName' capability was not provided in the desired 
[warn] [35m[Appium][39m   capabilities for this Android session
[warn] [35m[Appium][39m 
[warn] [35m[Appium][39m   Setting 'automationName=UiAutomator2' by default and using the 
[warn] [35m[Appium][39m   UiAutomator2 Driver
[warn] [35m[Appium][39m 
[warn] [35m[Appium][39m   The next major version of Appium (2.x) will **require** the 
[warn] [35m[Appium][39m   'automationName' capability to be set for all sessions on all 
[warn] [35m[Appium][39m   platforms
[warn] [35m[Appium][39m 
[warn] [35m[Appium][39m   In previous versions (Appium <= 1.13.x), the default was 
[warn] [35m[Appium][39m   'automationName=UiAutomator1'
[warn] [35m[Appium][39m 
[warn] [35m[Appium][39m   If you wish to use that automation instead of UiAutomator2, please 
[warn] [35m[Appium][39m   add 'automationName=UiAutomator1' to your desired capabilities
[warn] [35m[Appium][39m 
[warn] [35m[Appium][39m   For more information about drivers, please visit 
[warn] [35m[Appium][39m   http://appium.io/docs/en/about-appium/intro/ and explore the 
[warn] [35m[Appium][39m   'Drivers' menu
[warn] [35m[Appium][39m 
[warn] [35m[Appium][39m ======================================================================
[warn] [35m[Appium][39m 
[info] [35m[Appium][39m Appium v1.15.0 creating new AndroidUiautomator2Driver (v1.37.1) session
[debug] [35m[BaseDriver][39m W3C capabilities and MJSONWP desired capabilities were provided
[debug] [35m[BaseDriver][39m Creating session with W3C capabilities: {
[debug] [35m[BaseDriver][39m   "alwaysMatch": {
[debug] [35m[BaseDriver][39m     "platformName": "android",
[debug] [35m[BaseDriver][39m     "appium:app": "E:\\APKs\\com.zoho.cm_3_apps.evozi.com.apk",
[debug] [35m[BaseDriver][39m     "appium:deviceName": "Moto G5s Plus",
[debug] [35m[BaseDriver][39m     "appium:noReset": "true",
[debug] [35m[BaseDriver][39m     "appium:platformVersion": "8.1.0",
[debug] [35m[BaseDriver][39m     "appium:udid": "ZY32287N3R"
[debug] [35m[BaseDriver][39m   },
[debug] [35m[BaseDriver][39m   "firstMatch": [
[debug] [35m[BaseDriver][39m     {}
[debug] [35m[BaseDriver][39m   ]
[debug] [35m[BaseDriver][39m }
[warn] [35m[BaseDriver][39m Capability 'noReset' changed from string to boolean. This may cause unexpected behavior
[info] [35m[BaseDriver][39m Session created with session id: 5af4a01e-cdc6-4a9b-bc34-a7f630941fbf
[info] [35m[BaseDriver][39m Using local app 'E:\APKs\com.zoho.cm_3_apps.evozi.com.apk'
[debug] [35m[UiAutomator2][39m Checking whether app is actually present[debug] [35m[UiAutomator2][39m Deleting UiAutomator2 session
[debug] [35m[BaseDriver][39m Event 'newSessionStarted' logged at 1570803723439 (19:52:03 GMT+0530 (India Standard Time))
[debug] [35m[W3C][39m Encountered internal error running command: Error: Could not find 'adb.exe' in ["C:\\Users\\ky00372848\\AppData\\Local\\Android\\Sdk;\\platform-tools\\adb.exe","C:\\Users\\ky00372848\\AppData\\Local\\Android\\Sdk;\\emulator\\adb.exe","C:\\Users\\ky00372848\\AppData\\Local\\Android\\Sdk;\\tools\\adb.exe","C:\\Users\\ky00372848\\AppData\\Local\\Android\\Sdk;\\tools\\bin\\adb.exe"]. Do you have Android Build Tools installed at 'C:\Users\ky00372848\AppData\Local\Android\Sdk;'?
[debug] [35m[W3C][39m     at ADB.getBinaryFromSdkRoot (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-android-driver\node_modules\appium-adb\lib\tools\system-calls.js:106:11)
[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session [39m[31m500[39m [90m467 ms - 1644[39m
[info] [35m[HTTP][39m [90m[39m
 

K
Kalyan Reply on 15/10/2019

Dear Aditya,

Please respond!!

Thanks,

A
aditya Reply on 16/10/2019

Hi Kalyan 

please add desired capabilities as automationName= UiAutomator2.

this will help you in eradicating your problem and kindly make sure udid of your device is correct