initialize leak canary in debug build
This commit is contained in:
parent
add3760ed2
commit
54dca20bdb
2 changed files with 7 additions and 2 deletions
|
@ -19,10 +19,14 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
debug {
|
||||||
|
buildConfigField "boolean", "USE_LEAK_CANARY", "true"
|
||||||
|
}
|
||||||
release {
|
release {
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
signingConfig signingConfigs.release
|
signingConfig signingConfigs.release
|
||||||
|
buildConfigField "boolean", "USE_LEAK_CANARY", "false"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,18 +2,19 @@ package com.simplemobiletools.gallery
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import com.github.ajalt.reprint.core.Reprint
|
import com.github.ajalt.reprint.core.Reprint
|
||||||
|
import com.simplemobiletools.gallery.BuildConfig.USE_LEAK_CANARY
|
||||||
import com.squareup.leakcanary.LeakCanary
|
import com.squareup.leakcanary.LeakCanary
|
||||||
|
|
||||||
class App : Application() {
|
class App : Application() {
|
||||||
val USE_LEAK_CANARY = false
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
Reprint.initialize(this)
|
|
||||||
if (USE_LEAK_CANARY) {
|
if (USE_LEAK_CANARY) {
|
||||||
if (LeakCanary.isInAnalyzerProcess(this)) {
|
if (LeakCanary.isInAnalyzerProcess(this)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
LeakCanary.install(this)
|
LeakCanary.install(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reprint.initialize(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue