LeakCanary (2.0) blocking the main thread causes my instrumentation tests to fail

試著忘記壹切 提交于 2021-01-29 13:36:57

问题


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?

Thanks


回答1:


See the doc: https://square.github.io/leakcanary/recipes/#running-leakcanary-in-instrumentation-tests

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).



来源:https://stackoverflow.com/questions/57915748/leakcanary-2-0-blocking-the-main-thread-causes-my-instrumentation-tests-to-fai

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!