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

 

猜你喜欢

转载自www.cnblogs.com/cnmly/p/10223352.html