Unable to Launch android app with OS version greater than 6 and appium version1.7

I am using windows 10 virtual machine in mac, Have configured the java path, sdk path properly. still i am getting the following error with OS version 7 and greater with appium version 1.7.1.
Uanble to launch the app.

Appium error

Hi Veena,

I have tried automating native applications using Appium 1.7 and android OS 7, it works fine.

Looking at your error logs it seems that path of java.exe is wrong as it contains \bin\bin , please check it.

On the other hand make sure that you have imported all the jars of selenium , appium java client lib, and defined all the mandatory capabilites required to automate an native application.

Thanks Prasad for your reply!!

Even I thought the same and checked installed java version through cmd prompt its showing proper installed Java version.
Also I checked some selenium code it works fine, problem is with Appium I guess. Any help would be great.
Thaanks

Hi Veena,

I’m also facing problem in launching my app in Samsung phone with Android 7.0 and ASUS with 6.0 after upgrading to Appium 1.7.1 and Client library 5.0.1. Below is the error I’m getting.

In my case, the phone keeps on unlocking when trying to instantiate driver.

Did some debugging and have found out that the call to InstantiateAppiumdriver is not returning at all, and hence the issue. Have raised a issue for the same. (Appium driver does not instantiate in Android 7.0 , Appium client 5.0.1 , Appium Server 1.7.1 , Samsung)

For the same setup, I’m able to launch app in my LG phone, with Android 6.0. Not sure what OS and Device combination has this issue.

Server Error Logs:

[ADB] Removing forwarded port socket connection: 8200
[ADB] Running ‘C:\Users<Username>\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“ce11160bd21be81d05”,“forward”,"–remove",“tcp:8200”]
[MJSONWP] Encountered internal error running command: Error: Screen did not unlock successfully, retrying
at Object.callee$1$0$ (C:\Users<Username>\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-android-driver\lib\android-helpers.js:506:13)
at tryCatch (C:\Users<Username>\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users<Username>\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users<Username>\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Users<Username>\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7)


[HTTP] <-- GET /wd/hub/status 200 9 ms - 83
[ADB] Error: Error occured while starting App. Original error: Error executing adbExec. Original error: ‘Command ‘C:\Users\\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ce11160bd21be81d05 shell am start -W -n io.appium.unlock/.Unlock -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000’ timed out after 20000ms’; Stderr: ‘’; Code: ‘null’ at Object.wrappedLogger.errorAndThrow (C:\Users<username>\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13) at ADB.callee$0$0$ (C:\Users<Username>\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:101:9) at tryCatch (C:\Users<Username>\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40) at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users<Username>\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22) at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users<Username>\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21) at GeneratorFunctionPrototype.invoke (C:\Users<Username>\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37) Error: Error occured while starting App. Original error: Error executing adbExec. Original error: ‘Command ‘C:\Users\\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ce11160bd21be81d05 shell am start -W -n io.appium.unlock/.Unlock -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000’ timed out after 20000ms’; Stderr: ‘’; Code: ‘null’ at Object.wrappedLogger.errorAndThrow (C:\Users<Username>\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13) at ADB.callee$0$0$ (C:\Users<Username>\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:101:9) at tryCatch (C:\Users<Username>\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40) at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users<Username>\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22) at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users<Username>\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel- runtime\regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Users<Username>\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[AndroidDriver] Screen is locked, trying to unlock

To troubleshoot please run below code :slight_smile:

import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import javafx.scene.input.KeyCode;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileBy;
import io.appium.java_client.MobileElement;
import io.appium.java_client.PressesKeyCode;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidKeyCode;
import io.appium.java_client.pagefactory.bys.builder.AppiumByBuilder;
import io.appium.java_client.remote.MobileCapabilityType;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;

public class Flipkart {

static AppiumDriver<MobileElement> driver = null;

public static void main(String[] args) {

	try {
		DesiredCapabilities caps = new DesiredCapabilities();
		caps.setCapability(MobileCapabilityType.UDID, "ZY3222LHLW");
		caps.setCapability(MobileCapabilityType.DEVICE_NAME, "MotoG5");
		caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
		caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, "7.1.1");
		 caps.setCapability(MobileCapabilityType.AUTOMATION_NAME,
		 "uiautomator2");
		caps.setCapability("noReset", true);
		caps.setCapability("systemPort",4798 );
		caps.setCapability("newCommandTimeout", 300);
		// caps.setCapability("eventTimings", "true");
		caps.setCapability("appPackage", "com.flipkart.android");
		caps.setCapability("appActivity",
				".activity.HomeFragmentHolderActivity");
		driver = new AndroidDriver<MobileElement>(new URL(
				"http://127.0.0.1:4723/wd/hub"), caps);
		driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
		Thread.sleep(5000);

		

	} catch (MalformedURLException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (InterruptedException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} finally {
		// driver.close();
		driver.closeApp();

		driver.quit();
	}

}

}

The above code should launch flipkart application , if yes this confirms your setup is fine.

Hey Prasad,

With the same set up and os version is 6.0.1 and appium version is 1.4 works fine. but when device os is 7 or greater m facing the problem.

can you please let me know which appium version is used for os 7?
and is there any other settings need to do?

thanks,
Veena

Hi Veena,

I am using Appium Desktop with appium version 1.7.1