simplify the way we initialize LeakCanary in debug mode only
This commit is contained in:
parent
bcfd4af452
commit
e2b997e8b0
6 changed files with 15 additions and 24 deletions
|
@ -20,17 +20,20 @@ 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"
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
debug.java.srcDirs += 'src/debug/kotlin'
|
||||
release.java.srcDirs += 'src/release/kotlin'
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
package com.simplemobiletools.calendar
|
||||
|
||||
import com.squareup.leakcanary.LeakCanary
|
||||
|
||||
open class BuildVariantApplication : BaseApp() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
LeakCanary.install(this)
|
||||
}
|
||||
|
||||
override fun shouldInit() = !LeakCanary.isInAnalyzerProcess(this)
|
||||
}
|
|
@ -8,9 +8,7 @@
|
|||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_CALENDAR"/>
|
||||
|
||||
<uses-permission
|
||||
android:name="android.permission.USE_FINGERPRINT"
|
||||
tools:node="remove"/>
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
package com.simplemobiletools.calendar
|
||||
|
||||
import android.support.multidex.MultiDexApplication
|
||||
import com.facebook.stetho.Stetho
|
||||
import com.simplemobiletools.calendar.BuildConfig.USE_LEAK_CANARY
|
||||
import com.squareup.leakcanary.LeakCanary
|
||||
|
||||
class App : BuildVariantApplication() {
|
||||
class App : MultiDexApplication() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
if (!shouldInit()) {
|
||||
return
|
||||
if (USE_LEAK_CANARY) {
|
||||
if (LeakCanary.isInAnalyzerProcess(this)) {
|
||||
return
|
||||
}
|
||||
LeakCanary.install(this)
|
||||
}
|
||||
|
||||
Stetho.initializeWithDefaults(this)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,4 @@ package com.simplemobiletools.calendar
|
|||
|
||||
import android.support.multidex.MultiDexApplication
|
||||
|
||||
abstract class BaseApp : MultiDexApplication() {
|
||||
open fun shouldInit() = true
|
||||
}
|
||||
abstract class BaseApp : MultiDexApplication()
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
package com.simplemobiletools.calendar
|
||||
|
||||
open class BuildVariantApplication : BaseApp()
|
Loading…
Reference in a new issue