浓缩咖啡测试错误:AppNotIdleException [英] Espresso test error: AppNotIdleException

查看:29
本文介绍了浓缩咖啡测试错误: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)

推荐答案

最近几天我一直在努力解决这个问题.
这是我用来识别违规者"的方法:

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);
        }
    }
}

就我而言,Facebook SDK 使用的是 AsyncTask 线程池.

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

这篇关于浓缩咖啡测试错误:AppNotIdleException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆