Implementing a Leak Canary in Android Application

suggest change

In your build.gradle you need to add the below dependencies:

debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'

In your Application class you need to add the below code inside your onCreate():

LeakCanary.install(this);

That’s all you need to do for LeakCanary. The debug dependency shows a notification when it finds a leak. The release and test dependencies are no-ops.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents