Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Espresso test error: AppNotIdleException

Tags:

I turned off all animations on developer options. But I still get this exception when trying to click on one of the buttons.

My app is indeed active and not idle entirely, but I can't change it.

android.support.test.espresso.AppNotIdleException: Looped for 6930 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.doPerform(ViewInteraction.java:115)  at android.support.test.espresso.ViewInteraction.perform(ViewInteraction.java:87) 
like image 590
user5174803 Avatar asked Aug 09 '16 16:08

user5174803


1 Answers

I have been struggling with this problem for the last few days.
Here is a method that I used to identify "violators":

private void dumpThreads() {     int activeCount = Thread.activeCount();     Thread[] threads = new Thread[activeCount];     Thread.enumerate(threads);     for (Thread thread : threads) {         System.err.println(thread.getName() + ": " + thread.getState());         for (StackTraceElement stackTraceElement : thread.getStackTrace()) {             System.err.println("\t" + stackTraceElement);         }     } } 

In my case, Facebook SDK was using the AsyncTask thread pool.

like image 108
deadmoto Avatar answered Sep 24 '22 16:09

deadmoto