Android Leakcanary Implementing a Leak Canary in Android Application

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

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, it will automatically show notifications when there is a leak in your build.



Got any Android Question?