Espresso: AppNotIdleException

2020-07-16 02:34发布

问题:

I am continuously getting this error when I land on a page. What could be the solution to this?

android.support.test.espresso.AppNotIdleException: Looped for 4539 iterations over 60 SECONDS. The following Idle Conditions failed .
at dalvik.system.VMStack.getThreadStackTrace(Native Method)
at java.lang.Thread.getStackTrace(Thread.java:580)
at android.support.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:92)
at android.support.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:56)
at android.support.test.espresso.ViewInteraction.runSynchronouslyOnUiThread(ViewInteraction.java:184)
at android.support.test.espresso.ViewInteraction.check(ViewInteraction.java:158)

回答1:

It's very likely because you didn't turn off the following 3 settings in you developer options:

  • Window animation scale
  • Transition animation scale
  • Animator duration scale

For more informations read the tips to set up Espresso.

If that is not the case something seems to be interacting with your screen while the test is running.



回答2:

It might occur due to any UI element which is creating itself infinitely. For example, you have a Custom ProgressBar or Snackbar which is set to invisible/gone in xml and you are setting it visible in java code. But it might re-paint itself in invisible/gone state also due to ill-written code. So, go through any Custom UI elements as well if you have any.