KwaiAppTeam / KOOM

KOOM is an OOM killer on mobile platform by Kwai.
Other
3.2k stars 426 forks source link

leakcanary替换fast dump,release编译不过 #246

Closed clunyes closed 1 year ago

clunyes commented 1 year ago

现在项目中debugImplementation leakcanary,替换了fast dump 后

DefaultInitTask.init(applicationContext as Application)
    LeakCanary.config = LeakCanary.config.copy(
      heapDumper = HeapDumper {
        ForkJvmHeapDumper.getInstance().dump(it.absolutePath)
      })

release 编译不过,这咋处理

alhah commented 1 year ago

编译失败的日志帮忙发下

clunyes commented 1 year ago

就是我的leakcanary是debugImplementation依赖的,release没有。 下载leakcanary debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'是这么依赖的。

clunyes commented 1 year ago

现在不想leakcanary侵入release包。但是debug包想换个heapDumper,因为老是dump的时候,应用直接闪退。

alhah commented 1 year ago

debugImplementation fast-dump可以么?

clunyes commented 1 year ago

debugImplementation fast-dump可以么?

DefaultInitTask.init(applicationContext as Application)
LeakCanary.config = LeakCanary.config.copy(
heapDumper = HeapDumper {
ForkJvmHeapDumper.getInstance().dump(it.absolutePath)
})

那这段代码,release还是编译不了

alhah commented 1 year ago

你把这段代码放到一个子库里,然后debugImplementation,或者放到单独文件里,用gradle指定debug版编译