Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
627 views
in Technique[技术] by (71.8m points)

android - Espresso test error: AppNotIdleException

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)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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("" + stackTraceElement);
        }
    }
}

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...