adding Leak Canary
This commit is contained in:
parent
50df58f7f0
commit
74a258974c
|
@ -20,10 +20,14 @@ android {
|
|||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
buildConfigField "boolean", "USE_LEAK_CANARY", "true"
|
||||
}
|
||||
release {
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.release
|
||||
buildConfigField "boolean", "USE_LEAK_CANARY", "false"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,8 +41,15 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
leakCanaryVersion = '1.5.4'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
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()
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
tools:node="remove"/>
|
||||
|
||||
<application
|
||||
android:name=".App"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
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