Uiautomator exception: Could not detect idle state.

use uiautomator for ui testing in the unit test, and report an error when getting the control:

W/UiAutomatorBridge: Could not detect idle state.
                     java.util.concurrent.TimeoutException: No idle state with idle timeout: 500 within global timeout: 10000
                         at android.app.UiAutomation.waitForIdle(UiAutomation.java:589)
                         at android.support.test.uiautomator.UiAutomatorBridge.waitForIdle(UiAutomatorBridge.java:112)
                         at android.support.test.uiautomator.UiDevice.waitForIdle(UiDevice.java:639)
                         at android.support.test.uiautomator.UiDevice.waitForIdle(UiDevice.java:629)
                         at android.support.test.uiautomator.UiDevice.getDisplayRotation(UiDevice.java:794)
                         at android.support.test.uiautomator.AccessibilityNodeInfoDumper.dumpWindowHierarchy(AccessibilityNodeInfoDumper.java:47)
                         at android.support.test.uiautomator.UiDevice.dumpWindowHierarchy(UiDevice.java:953)
                         at android.support.test.uiautomator.UiDevice.dumpWindowHierarchy(UiDevice.java:940)
                         at org.yws.testin.xml.XMLUtil.dump(XMLUtil.java:31)
                         at org.yws.testin.MyTest.t(MyTest.java:29)
                         at java.lang.reflect.Method.invoke(Native Method)
                         at java.lang.reflect.Method.invoke(Method.java:372)
                         at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
                         at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
                         at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
                         at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
                         at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
                         at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
                         at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
                         at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
                         at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
                         at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
                         at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
                         at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
                         at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
                         at android.support.test.runner.AndroidJUnit4.run(AndroidJUnit4.java:101)
                         at org.junit.runners.Suite.runChild(Suite.java:128)
                         at org.junit.runners.Suite.runChild(Suite.java:27)
                         at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
                         at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
                         at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
                         at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
                         at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
                         at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
                         at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
                         at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
                         at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
                         at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:384)
                         at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1846)
         

every interface is like this. May I ask

  1. what is the reason for this phenomenon? is the development of app interface not standard?
  2. how to get ui element information in this case?

Thank you very much!

Aug.17,2021
Menu