LeakCanary(2.0)阻塞主线程导致我的检测测试失败 [英] LeakCanary (2.0) blocking the main thread causes my instrumentation tests to fail

查看:124
本文介绍了LeakCanary(2.0)阻塞主线程导致我的检测测试失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我针对应用的调试版本运行检测测试时,泄漏的金丝雀会阻塞UI线程并导致检测测试失败.我不得不恢复到旧版本.在运行检测测试时,有什么方法可以避免运行leakcanary UI或同伴应用程序(不确定是什么阻止了UI线程)?

when I run my instrumentation tests against the debug version of my app, leak canary will block the UI thread and cause the instrumentation test to fail. I had to revert to the old version. Is there any way to avoid the leakcanary UI or companion app (not sure what is blocking the UI thread) from running, while running the instrumentation tests?

谢谢

推荐答案

请参阅文档:

如果LeakCanary从运行时类路径中的androidx.test依赖项检测到类,则通过将LeakCanary.config.dumpHeap设置为false来自动禁用自身.如果您在没有androidx.test的情况下运行UI测试,我们强烈建议您将dumpHeap设置为false:LeakCanary.config = LeakCanary.config.copy(dumpHeap = false).

LeakCanary automatically disables itself by setting LeakCanary.config.dumpHeap to false if it detects classes from the androidx.test dependency in the runtime classpath. If you run UI tests without androidx.test, we strongly advise that you set dumpHeap to false: LeakCanary.config = LeakCanary.config.copy(dumpHeap = false).

这篇关于LeakCanary(2.0)阻塞主线程导致我的检测测试失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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