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:
- same issue in droiddriver
- uiautomator2 sources
- uiautomator2 disconnect line
- window manager issue
- uiautomator bug reported upstream
@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:
- Created 7 years ago
- Comments:11 (3 by maintainers)
Top GitHub Comments
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
This looks like a third party issue to me