UiAutomator instance thowing - IllegalStateException: UiAutomation not connected! exception

See original GitHub issue

@sravanmedarapu commented on Tue Apr 19 2016

below is the stacktrace

04-19 19:01:38.116  5105  5127 W System.err: java.lang.IllegalStateException: UiAutomation not connected!
04-19 19:01:38.116  5105  5127 W System.err:    at android.app.UiAutomation.throwIfNotConnectedLocked(UiAutomation.java:971)
04-19 19:01:38.116  5105  5127 W System.err:    at android.app.UiAutomation.waitForIdle(UiAutomation.java:577)
04-19 19:01:38.116  5105  5127 W System.err:    at android.support.test.uiautomator.UiAutomatorBridge.waitForIdle(UiAutomatorBridge.java:112)
04-19 19:01:38.116  5105  5127 W System.err:    at android.support.test.uiautomator.UiDevice.waitForIdle(UiDevice.java:639)
04-19 19:01:38.116  5105  5127 W System.err:    at android.support.test.uiautomator.UiDevice.waitForIdle(UiDevice.java:629)
04-19 19:01:38.116  5105  5127 W System.err:    at android.support.test.uiautomator.UiDevice.getWindowRoots(UiDevice.java:1074)
04-19 19:01:38.116  5105  5127 W System.err:    at android.support.test.uiautomator.UiDevice.findObject(UiDevice.java:164)
04-19 19:01:38.116  5105  5127 W System.err:    at io.appium.uiautomator2.handler.FindElement.findElememnt(FindElement.java:71)
04-19 19:01:38.116  5105  5127 W System.err:    at io.appium.uiautomator2.handler.FindElement.safeHandle(FindElement.java:45)
04-19 19:01:38.116  5105  5127 W System.err:    at io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:159)
04-19 19:01:38.116  5105  5127 W System.err:    at io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:150)
04-19 19:01:38.117  5105  5127 W System.err:    at io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:45)
04-19 19:01:38.117  5105  5127 W System.err:    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
04-19 19:01:38.117  5105  5127 W System.err:    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
04-19 19:01:38.117  5105  5127 W System.err:    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
04-19 19:01:38.117  5105  5127 W System.err:    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
04-19 19:01:38.117  5105  5127 W System.err:    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
04-19 19:01:38.117  5105  5127 W System.err:    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163)
04-19 19:01:38.118  5105  5127 W System.err:    at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:148)
04-19 19:01:38.118  5105  5127 W System.err:    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
04-19 19:01:38.118  5105  5127 W System.err:    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
04-19 19:01:38.118  5105  5127 W System.err:    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787)
04-19 19:01:38.118  5105  5127 W System.err:    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:125)
04-19 19:01:38.118  5105  5127 W System.err:    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
04-19 19:01:38.118  5105  5127 W System.err:    at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:430)
04-19 19:01:38.118  5105  5127 W System.err:    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:384)
04-19 19:01:38.118  5105  5127 W System.err:    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
04-19 19:01:38.118  5105  5127 W System.err:    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
04-19 19:01:38.118  5105  5127 W System.err:    at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
04-19 19:01:38.118  5105  5127 W System.err:    at java.lang.Thread.run(Thread.java:818)

This is happening only when we are doing e2e testing (after uiautomator2 driver+server integration). However this is not reproduced while testing the server part independently.

below are the logcat and server console logs abd logcat: https://gist.github.com/sravanmedarapu/e5c3193f143196b60a81298946060678#file-adb_logcat

appium server log: https://gist.github.com/sravanmedarapu/e5c3193f143196b60a81298946060678#file-appium_console_log

Observations: throwing above exception immediately after executing below statement in logcat

W WindowManager: Attempted to remove non-existing token: android.os.Binder@2728fc2


@bootstraponline commented on Wed Apr 20 2016

related source links:


@sravanmedarapu commented on Wed May 18 2016

Tried by using 3rd party module called adbKit instead of existing appium-adb to invoke instrument test and working fine.

Need to figure out the what is going wrong with appium-adb module.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
Vishnu-Jmaticscommented, Mar 6, 2019

I think it’s due to adding test dependencies in gradle. Like testInstrumentationRunner “android.support.test.runner.AndroidJUnitRunner” or any testing dependencies like espresso. Remove it then can solving this issue

0reactions
mykola-mokhnachcommented, Oct 3, 2018

This looks like a third party issue to me

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - Pre-launch reports UiAutomation not connected error
It only happens with Samsung galaxy S9. java.lang.IllegalStateException: UiAutomation not connected! at android.app.UiAutomation.
Read more >
java.lang.IllegalStateException: UiAutomation not connected!
android packages recently: when Google Play runs pre-launch tests on deployed apk, the app is crashing on many devices with the following error:....
Read more >
Diff - 80943d8daa6ab31ab5c486d57aea406aa0730d58^! - platform ...
@throws IllegalStateException If already connected. ... 0) { - throw new IllegalStateException("Cound not register UiAutomationService.
Read more >
UiAutomation.java - Android Code Search
@throws IllegalStateException If the connection to the accessibility subsystem ... For example, if there is a modal dialog shown and the user cannot...
Read more >
Dealing with emulator issues and Android UI test failures on CI
From a testing perspective you would not care about the resource names of the ... The above example shows a simple UiAutomator test...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found