Unable to run Appium test on Android 7.0 / 7.1

I have already seen the Appium discussion about Android 7.0 but no one helps me :(,

My pc is ready for Appium, its working fine for Android 6.0, but while trying to run on Android 7.0 / 7.1 its not working. While trying to run test script(which already worked fine on 6.0) on android(7.0) device, it just tying to open AppiumSettings app and at this moment going to fail.

PC OS: Windows 10 
Appium version: 1.7.1
Npm version: 3.10.3

I’m using below dependencies:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.4.0</version>
</dependency>

<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>6.9.10</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>io.appium</groupId>
    <artifactId>java-client</artifactId>
    <version>4.1.2</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-server-standalone</artifactId>
    <version>2.53.0</version>
</dependency>

Appium server error log:

[ADB] Checking whether adb is present
[ADB] Using adb.exe from C:\Android\sdk\platform-tools\adb.exe
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices...
[debug] [ADB] 0 device(s) connected
[debug] [ADB] Could not find devices, restarting adb server...
……….
 [debug] [AndroidDriver] Called deleteSession but bootstrap wasn't active
[MJSONWP] Encountered internal error running command: Error: Could not find a connected Android device.
    at ADB.getDevices$ (../../../lib/tools/system-calls.js:187:13)
    at tryCatch (MyPcLocation\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (MyPcLocation\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (MyPcLocation\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at invoke (MyPcLocation\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
    at enqueueResult (MyPcLocation\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:185:17)
    at Promise.exports.(anonymous function).target.(anonymous function).function.target.(anonymous function).F (MyPcLocation\AppData\Roaming\npm\node_modules\appium\node_modules\core-js\library\modules\$.export.js:30:36)
    at AsyncIterator.enqueue (MyPcLocation\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:184:12)
    at AsyncIterator.prototype.(anonymous function) [as next] (MyPcLocation\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at Object.runtime.async (MyPcLocation\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:209:12)
    at getDevices (../../../lib/tools/system-calls.js:190:18)
    at ADB.getDevices$ (../../../lib/tools/system-calls.js:204:20)
    at tryCatch (MyPcLocation\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (MyPcLocation\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (MyPcLocation\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (MyPcLocation\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[HTTP] <-- POST /wd/hub/session 500 29803 ms - 179

IDE Error log:

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not find a connected Android device. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 29.92 seconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'DESKTOP-218CL4U', ip: , os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_25'
Driver info: driver.version: AndroidDriver

	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
	at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)
	at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
	at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
	at org.openqa.selenium.remote.JsonWireProtocolResponse$$Lambda$72/1725165248.apply(Unknown Source)
	at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
	at org.openqa.selenium.remote.JsonWireProtocolResponse$$Lambda$74/452121674.apply(Unknown Source)
	at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$22(ProtocolHandshake.java:365)
	at org.openqa.selenium.remote.ProtocolHandshake$$Lambda$81/1537471098.apply(Unknown Source)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:529)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:516)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502)
	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:368)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:159)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
	at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:69)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
	at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
	at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
	at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:137)
	at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:36)
	at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:114)
	at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:132)
	at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:92)
	at settings.AndroidSettings.prepareAndroidForAppium(AndroidSettings.java:30)
	at settings.RunCases.setUp(RunCases.java:38)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
	at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:514)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:215)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
	at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:178)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
	at org.testng.TestRunner.privateRun(TestRunner.java:782)
	at org.testng.TestRunner.run(TestRunner.java:632)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
	at org.testng.SuiteRunner.run(SuiteRunner.java:268)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
	at org.testng.TestNG.run(TestNG.java:1064)
	at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
	at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)
  1. I didn’t check release notes for newest version of appium client but at first glance it seems like you need newer client https://mvnrepository.com/artifact/io.appium/java-client/5.0.3
  2. 0 devices connected - does adb list command show connected device? I mean, if you run adb from terminal
  1. My device is connected now
  2. I have used latest java-client that is 5.0.4
  3. Java version is: 1.8.0_25

Dependencies are

      <dependency>
           <groupId>io.appium</groupId>
           <artifactId>java-client</artifactId>
           <version>5.0.4</version>
       </dependency>

       <dependency>
           <groupId>org.seleniumhq.selenium</groupId>
           <artifactId>selenium-java</artifactId>
           <version>3.6.0</version>
       </dependency>


       <dependency>
           <groupId>org.testng</groupId>
           <artifactId>testng</artifactId>
           <version>6.11</version>
           <scope>test</scope>
       </dependency>

But still showing error

> error: Failed to start an Appium session, err was: Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "PCloc\platform-tools\adb.exe -s UDID shell "ps 'uiautomator'""
> 
> info: [debug] Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "PCloc\platform-tools\adb.exe -s UDID shell "ps 'uiautomator'""
> 
>     at ChildProcess.exithandler (child_process.js:751:12)
>     at ChildProcess.emit (events.js:110:17)
>     at maybeClose (child_process.js:1016:16)
>     at Process.ChildProcess._handle.onexit (child_process.js:1088:5)
> info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Command failed: C:\\WINDOWS\\system32\\cmd.exe /s /c \"PCLoc\\platform-tools\\adb.exe -s UDID shell \"ps 'uiautomator'\"\"\n)","killed":false,"code":1,"signal":null,"cmd":"C:\\WINDOWS\\system32\\cmd.exe /s /c \"PCloc\\platform-tools\\adb.exe -s UDID shell \"ps 'uiautomator'\"\"","origValue":"Command failed: C:\\WINDOWS\\system32\\cmd.exe /s /c \"PCLOC\\platform-tools\\adb.exe -s udid shell \"ps 'uiautomator'\"\"\n"},"sessionId":null}
> info: <-- POST /wd/hub/session 500 9281.848 ms - 586

What about versions of node, npm and appium?