1.build.gradle添加配置
implementation 'com.squareup.leakcanary:leakcanary-android:1.6'
2.Application添加代码
public class LaunchApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
if (LeakCanary.isInAnalyzerProcess(this)) {//1
// This process is dedicated to LeakCanary for heap analysis.
// You should not init your app in this process.
return;
}
LeakCanary.install(this);
}
}
3.AndroidManifest.xml配置Applicaton
<application
android:name=".LaunchApplication"
...
</applicaiton>
网友评论