Files
leakcanary/docs/getting_started.md
Amanjeet Singh 217bb438c6 Adding automatically detection of services in docs
Leak canary is also capable to detect leaking services. Also, saw the change log here: https://square.github.io/leakcanary/changelog/#detecting-services-retained-after-serviceondestroy
2022-01-13 02:00:46 +05:30

917 B

Getting started

To use LeakCanary, add the leakcanary-android dependency to your app's build.gradle file:

dependencies {
  // debugImplementation because LeakCanary should only run in debug builds.
  debugImplementation 'com.squareup.leakcanary:leakcanary-android:{{ leak_canary.release }}'
}

That's it, there is no code change needed!

Confirm that LeakCanary is running on startup by filtering on the LeakCanary tag in Logcat:

D LeakCanary: LeakCanary is running and ready to detect leaks

!!! info LeakCanary automatically detects leaks of the following objects:

* destroyed `Activity` instances
* destroyed `Fragment` instances
* destroyed fragment `View` instances
* cleared `ViewModel` instances
* destroyed `Service` instance

What's next? Learn the Fundamentals!