1 实现原理
github搜索 LeakCanary
本质上还是用命令控制生成hprof文件分析检查内存泄露。
2 快速集成
build.gradle
dependencies {
// debugImplementation because LeakCanary should only run in debug builds.
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.1'
}
3 相比旧版,不需要在Application中集成
运行app后,日志 过滤LeakCanary,打印: Installing AppWatcher表明集成成功
4 使用
当出现内存泄漏时,会有log打印

534

被折叠的 条评论
为什么被折叠?



