找不到符号类AndroidExcludedRefs、DisplayLeakService、,
我们在项目的Github页面上声明了我们的泄漏金丝雀依赖项找不到符号类AndroidExcludedRefs、DisplayLeakService、,,android,leakcanary,Android,Leakcanary,我们在项目的Github页面上声明了我们的泄漏金丝雀依赖项 debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1' releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1' 到目前为止,一切进展顺利。现在我们开始排除这样一个已知的泄漏: ExcludedRefs.Builder excludedRefsBuilder = AndroidE
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
到目前为止,一切进展顺利。现在我们开始排除这样一个已知的泄漏:
ExcludedRefs.Builder excludedRefsBuilder = AndroidExcludedRefs.createAppDefaults();
excludedRefsBuilder.staticField("com.google.android.chimera.container.a", "a");
refWatcher = LeakCanary.install(app, DisplayLeakService.class, excludedRefsBuilder.build());
现在,当我们切换到发行版构建类型时,像AndroidExcludedRefs、DisplayLeakService和ExcludedRefs这样的类就再也找不到了,因为“no op”依赖项不包括它们
处理此问题的最佳方法是什么?我们的LeakCanary设置是在名为DevToolsController的类中实现的。为了解决这个问题,我们将默认实现放在“debug”源文件夹中,将“no-op”实现放在“release”源文件夹中。这让你想知道为什么会有一个no-op库,因为我们只需在这些debug/release文件夹中放置实际调用即可将它们放入/排除。你找到解决方案了吗?