美文网首页
检测app内存溢出工具

检测app内存溢出工具

作者: 一页书啊 | 来源:发表于2016-10-18 08:21 被阅读122次
Paste_Image.png

app的gradle中添加以下:
dependencies {
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
}

MyApplication添加以下:

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...
}
}

相关文章

网友评论

      本文标题:检测app内存溢出工具

      本文链接:https://www.haomeiwen.com/subject/pywzyttx.html