Android 内存泄漏检测

LeakCanary 工具的使用

官网

https://www.liaohuqiu.net/cn/posts/leak-canary-read-me/

使用

  • 添加依赖
 dependencies {
    //leakcanary
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2'
    // Optional, if you use support library fragments:
    debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.2'
 }
  • Application 中初始化
   LeakCanary.install(this);

你可能感兴趣的:(Android 内存泄漏检测)