android个人笔记之leakcanary初始化
来源:互联网 发布:种子文件下载软件 编辑:程序博客网 时间:2024/05/13 09:06
1.在工程gradle加上后面2句
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.4.0' debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta2' releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'}
2.在自己定义的application这样写
public void onCreate() { super.onCreate();3.在activity的ondestory里面这样写if (LeakCanary.isInAnalyzerProcess(this)) { // This process is dedicated to LeakCanary for heap analysis. // You should not init your app in this process. return;}refWatcher = LeakCanary.install(this);}public static RefWatcher getRefWatcher(Context context) { MApplication application = (MApplication) context.getApplicationContext(); return application.refWatcher;}private RefWatcher refWatcher;
@Overrideprotected void onDestroy() { super.onDestroy(); RefWatcher refWatcher = MApplication.getRefWatcher(this); refWatcher.watch(this);}eclipse 看这里:
http://blog.csdn.net/liudehuaii18/article/details/46287695
0 0
- android个人笔记之leakcanary初始化
- Android性能提升之LeakCanary
- Android AndroidStudio MAT LeakCanary 内存分析之 LeakCanary
- Android检测内存泄漏之leakcanary
- Android内存泄露监测工具之leakcanary
- Android开发学习之路-LeakCanary使用
- Android内存泄露监测之leakcanary
- Android 内存泄露神器之LeakCanary
- Android LeakCanary
- Android Studio JNI使用之个人笔记
- android个人笔记之greendao初体验
- android个人笔记之 toolbar 动画
- android开发笔记之内存泄漏检测工具leakcanary
- Android AndroidStudio MAT LeakCanary 内存分析之 初识内存泄漏
- Android AndroidStudio MAT LeakCanary 内存分析之 DDMS+MAT
- 《简单笔记》leakcanary基本原理
- Java学习个人笔记---java数组初始化
- 内存检测工具之LeakCanary
- java中静态代码块的用法 static用法详解
- 深圳绘制SVG地图数据
- Linux中的Xargs命令,支持|管道传递参数
- NDK开发 从入门到放弃(二:动态注册JNI、多JNI调用)
- 笔记1.0
- android个人笔记之leakcanary初始化
- Json字符串和Json对象
- static用法
- 使用java中replaceAll方法替换字符串中的反斜杠
- java数组
- JAVA设置HttpOnly Cookies
- java二叉树
- Solidworks修改toobox属性
- 浙大数据结构基础4-1 Level-order Traversal (10分)