Android内存泄漏
// debugImplementation because LeakCanary should only run in debug builds.
Android 如何有效的解决内存泄漏的问题 - 赵彦军 - 博客园
square/leakcanary: A memory leak detection library for Android
Getting started
Add LeakCanary to build.gradle:
dependencies {
// debugImplementation because LeakCanary should only run in debug builds.
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-alpha-2'
}
That’s it, there is no code change needed! LeakCanary will automatically show a notification when a memory leak is detected in debug builds.