diff --git a/app/build.gradle b/app/build.gradle
index 009e52673..1e71b4d16 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -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 {
diff --git a/app/src/debug/kotlin/com/simplemobiletools/calendar/BuildVariantApplication.kt b/app/src/debug/kotlin/com/simplemobiletools/calendar/BuildVariantApplication.kt
deleted file mode 100644
index 537597b53..000000000
--- a/app/src/debug/kotlin/com/simplemobiletools/calendar/BuildVariantApplication.kt
+++ /dev/null
@@ -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)
-}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 51cf957fc..9c9e7e3fd 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -8,9 +8,7 @@
-
-
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/App.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/App.kt
index a55f7ddb6..93a89298e 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/App.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/App.kt
@@ -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)
}
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/BaseApp.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/BaseApp.kt
index 80cd88d44..932fab2bc 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/BaseApp.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/BaseApp.kt
@@ -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()
diff --git a/app/src/release/kotlin/com/simplemobiletools/calendar/BuildVariantApplication.kt b/app/src/release/kotlin/com/simplemobiletools/calendar/BuildVariantApplication.kt
deleted file mode 100644
index 79e64e374..000000000
--- a/app/src/release/kotlin/com/simplemobiletools/calendar/BuildVariantApplication.kt
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.simplemobiletools.calendar
-
-open class BuildVariantApplication : BaseApp()