Espresso test error: AppNotIdleException

前端 未结 4 1483
栀梦
栀梦 2020-12-11 14:32

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 ent

4条回答
  •  醉梦人生
    2020-12-11 15:28

    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.

提交回复
热议问题