mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-26 05:20:10 +01:00
adding Leakcanary
This commit is contained in:
parent
bff373afac
commit
1ef3528a62
@ -21,11 +21,13 @@ android {
|
|||||||
buildTypes {
|
buildTypes {
|
||||||
debug {
|
debug {
|
||||||
applicationIdSuffix ".debug"
|
applicationIdSuffix ".debug"
|
||||||
|
buildConfigField "boolean", "USE_LEAK_CANARY", "true"
|
||||||
}
|
}
|
||||||
release {
|
release {
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
signingConfig signingConfigs.release
|
signingConfig signingConfigs.release
|
||||||
|
buildConfigField "boolean", "USE_LEAK_CANARY", "false"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,10 +41,17 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ext {
|
||||||
|
leakCanaryVersion = '1.5.4'
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.simplemobiletools:commons:2.38.5'
|
compile 'com.simplemobiletools:commons:2.38.5'
|
||||||
compile 'com.facebook.stetho:stetho:1.5.0'
|
compile 'com.facebook.stetho:stetho:1.5.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 {
|
||||||
|
@ -2,10 +2,19 @@ package com.simplemobiletools.notes
|
|||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import com.facebook.stetho.Stetho
|
import com.facebook.stetho.Stetho
|
||||||
|
import com.simplemobiletools.notes.BuildConfig.USE_LEAK_CANARY
|
||||||
|
import com.squareup.leakcanary.LeakCanary
|
||||||
|
|
||||||
class App : Application() {
|
class App : Application() {
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
|
if (USE_LEAK_CANARY) {
|
||||||
|
if (LeakCanary.isInAnalyzerProcess(this)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
LeakCanary.install(this)
|
||||||
|
}
|
||||||
|
|
||||||
if (BuildConfig.DEBUG)
|
if (BuildConfig.DEBUG)
|
||||||
Stetho.initializeWithDefaults(this)
|
Stetho.initializeWithDefaults(this)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user