adding Leak Canary
This commit is contained in:
parent
50df58f7f0
commit
74a258974c
|
@ -20,10 +20,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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,8 +41,15 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ext {
|
||||||
|
leakCanaryVersion = '1.5.4'
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.simplemobiletools:commons:2.41.5'
|
implementation 'com.simplemobiletools:commons:2.41.5'
|
||||||
|
|
||||||
|
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
|
||||||
|
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
|
||||||
}
|
}
|
||||||
|
|
||||||
Properties props = new Properties()
|
Properties props = new Properties()
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
tools:node="remove"/>
|
tools:node="remove"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
|
android:name=".App"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_launcher_name"
|
android:label="@string/app_launcher_name"
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.simplemobiletools.draw
|
||||||
|
|
||||||
|
import android.app.Application
|
||||||
|
import com.simplemobiletools.draw.BuildConfig.USE_LEAK_CANARY
|
||||||
|
import com.simplemobiletools.draw.extensions.config
|
||||||
|
import com.squareup.leakcanary.LeakCanary
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class App : Application() {
|
||||||
|
override fun onCreate() {
|
||||||
|
super.onCreate()
|
||||||
|
if (USE_LEAK_CANARY) {
|
||||||
|
if (LeakCanary.isInAnalyzerProcess(this)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
LeakCanary.install(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.useEnglish) {
|
||||||
|
val conf = resources.configuration
|
||||||
|
conf.locale = Locale.ENGLISH
|
||||||
|
resources.updateConfiguration(conf, resources.displayMetrics)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue