Add LeakCanary for debug versions of the app
This commit is contained in:
parent
3eef430226
commit
1beab19679
|
@ -33,9 +33,15 @@ android {
|
|||
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
debug.java.srcDirs += 'src/debug/kotlin'
|
||||
release.java.srcDirs += 'src/release/kotlin'
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
leakCanaryVersion = '1.5.2'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.simplemobiletools:commons:2.25.3'
|
||||
compile 'joda-time:joda-time:2.9.1'
|
||||
|
@ -57,6 +63,8 @@ dependencies {
|
|||
}
|
||||
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
debugCompile "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
|
||||
releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
|
||||
}
|
||||
|
||||
buildscript {
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.simplemobiletools.calendar
|
||||
|
||||
import com.squareup.leakcanary.LeakCanary
|
||||
|
||||
open class BuildVariantApplication : BaseApp() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
LeakCanary.install(this);
|
||||
}
|
||||
|
||||
override fun shouldInit(): Boolean {
|
||||
return !LeakCanary.isInAnalyzerProcess(this)
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="leak_canary_display_activity_label">Calendar Leaks</string>
|
||||
</resources>
|
|
@ -1,11 +1,13 @@
|
|||
package com.simplemobiletools.calendar
|
||||
|
||||
import android.support.multidex.MultiDexApplication
|
||||
import com.facebook.stetho.Stetho
|
||||
|
||||
class App : MultiDexApplication() {
|
||||
class App : BuildVariantApplication() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
if (!shouldInit()) {
|
||||
return
|
||||
}
|
||||
Stetho.initializeWithDefaults(this)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package com.simplemobiletools.calendar
|
||||
|
||||
import android.support.multidex.MultiDexApplication
|
||||
|
||||
abstract class BaseApp : MultiDexApplication() {
|
||||
open fun shouldInit(): Boolean {
|
||||
return true
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
package com.simplemobiletools.calendar
|
||||
|
||||
open class BuildVariantApplication : BaseApp()
|
Loading…
Reference in New Issue