I am using leak canary to detect potential leaks in my Android application. But when I was developing feature , it is quite disturbing as it starts taking heap dumps time to time. I am using it in debugImplemetation.
dependencies {
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'
}
Now , I want to disable it temporarily. How can I do that ?. One anwer I found is
LeakCanary.Config config = LeakCanary.getConfig().newBuilder()
.dumpHeap(false)
.build();
LeakCanary.setConfig(config)
It works but In release mode this library is not available so it will not compile. If I use implementation instead of debugImplemetation , I will increase apk size and not adding any value. Is there anything I can do ?