LeakCanary 引用

1、功能说明

用于检测应用运行内存溢出等。

2、gradle引用

debugImplementation "com.squareup.leakcanary:leakcanary-android:1.6.2"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:1.6.2"
testImplementation "com.squareup.leakcanary:leakcanary-android-no-op:1.6.2"

3、初始化使用

public class ExampleApplication extends Application {

  @Override public void onCreate() {
    super.onCreate();
    if (LeakCanary.isInAnalyzerProcess(this)) {
      // This process is dedicated to LeakCanary for heap analysis.
      // You should not init your app in this process.
      return;
    }
    LeakCanary.install(this);
    // Normal app init code...
  }
}

来源:https://github.com/square/leakcanary

 

 

 
posted @ 2019-01-05 09:12  后天打老虎  阅读(458)  评论(0编辑  收藏  举报