add leak canary for detecting memory leaks at debug builds

This commit is contained in:
tibbi 2017-04-17 20:31:50 +02:00
parent c4c19f82af
commit d914f0bb53
3 changed files with 19 additions and 0 deletions

View File

@ -40,6 +40,10 @@ dependencies {
compile 'com.github.chrisbanes:PhotoView:1.3.1' compile 'com.github.chrisbanes:PhotoView:1.3.1'
compile 'it.sephiroth.android.exif:library:1.0.1' compile 'it.sephiroth.android.exif:library:1.0.1'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
} }
buildscript { buildscript {

View File

@ -7,6 +7,7 @@
<uses-permission android:name="android.permission.SET_WALLPAPER"/> <uses-permission android:name="android.permission.SET_WALLPAPER"/>
<application <application
android:name=".App"
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_launcher_name" android:label="@string/app_launcher_name"

View File

@ -0,0 +1,14 @@
package com.simplemobiletools.gallery
import android.app.Application
import com.squareup.leakcanary.LeakCanary
class App : Application() {
override fun onCreate() {
super.onCreate()
if (LeakCanary.isInAnalyzerProcess(this)) {
return
}
LeakCanary.install(this)
}
}