LeakCanary (2.0) 阻塞主线程导致我的仪器测试失败

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

当我 运行 我的仪器测试针对我的应用程序的调试版本时,泄漏金丝雀将阻塞 UI 线程并导致仪器测试失败。我不得不恢复到旧版本。有什么方法可以避免 运行ning 的 leakcanary UI 或配套应用程序(不确定是什么阻塞了 UI 线程),而 运行ning 仪器测试?

谢谢

查看文档: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).