LeakCanary的接入方式

在build.gradle文件添加引用

debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
 releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2'

然后在初始化Application的时候做初始化

//在Application的onCreate方法中调用初始化方法

protected RefWatcher setupLeakCanary()
    {
        if (LeakCanary.isInAnalyzerProcess(this))
        {
            return RefWatcher.DISABLED;
        }
        return LeakCanary.install(this);
    }
0 0 vote
Article Rating
Subscribe
提醒
guest
0 评论
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x