眾所周知,leakcanary作為square公司出品的一款內(nèi)存檢測(cè)工具,具有集成簡(jiǎn)單、檢測(cè)效率高等優(yōu)點(diǎn)被許多開(kāi)發(fā)者大量使用。
- 其github項(xiàng)目地址:點(diǎn)擊此處進(jìn)入
- 項(xiàng)目中引入方式:
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' - 調(diào)用方式:
Application中加入如下代碼即可在debug模式下調(diào)試
public void onCreate() {
super.onCreate();
LeakCanary.install(this);
} -
Log顯示GC日志:
Paste_Image.png -
設(shè)備通知欄顯示提示,點(diǎn)開(kāi)后截圖為:
Paste_Image.png

