Merge pull request #202 from jonathan-caryl/leak_canary
Add LeakCanary for debug versions of the app
This commit is contained in:
commit
84e6a779ed
|
@ -33,9 +33,15 @@ android {
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main.java.srcDirs += 'src/main/kotlin'
|
main.java.srcDirs += 'src/main/kotlin'
|
||||||
|
debug.java.srcDirs += 'src/debug/kotlin'
|
||||||
|
release.java.srcDirs += 'src/release/kotlin'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ext {
|
||||||
|
leakCanaryVersion = '1.5.2'
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.simplemobiletools:commons:2.25.3'
|
compile 'com.simplemobiletools:commons:2.25.3'
|
||||||
compile 'joda-time:joda-time:2.9.1'
|
compile 'joda-time:joda-time:2.9.1'
|
||||||
|
@ -44,6 +50,8 @@ dependencies {
|
||||||
compile 'com.android.support:multidex:1.0.1'
|
compile 'com.android.support:multidex:1.0.1'
|
||||||
compile 'com.google.code.gson:gson:2.8.0'
|
compile 'com.google.code.gson:gson:2.8.0'
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
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 {
|
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
|
package com.simplemobiletools.calendar
|
||||||
|
|
||||||
import android.support.multidex.MultiDexApplication
|
|
||||||
import com.facebook.stetho.Stetho
|
import com.facebook.stetho.Stetho
|
||||||
|
|
||||||
class App : MultiDexApplication() {
|
class App : BuildVariantApplication() {
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
|
if (!shouldInit()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
Stetho.initializeWithDefaults(this)
|
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