From 5a2717cf0c1200bef75e30fcd4c9fb08911225c4 Mon Sep 17 00:00:00 2001 From: serso Date: Mon, 11 May 2015 16:21:48 +0200 Subject: [PATCH] LeakCanary library added --- android-app/build.gradle | 3 +++ .../android/calculator/CalculatorApplication.java | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/android-app/build.gradle b/android-app/build.gradle index 1761c158..6c9ad467 100644 --- a/android-app/build.gradle +++ b/android-app/build.gradle @@ -75,6 +75,9 @@ dependencies { compile 'com.google.android.gms:play-services-ads:6.5.87@aar' compile 'com.google.android.gms:play-services-base:6.5.87@aar' compile 'com.melnykov:floatingactionbutton:1.1.0' + + debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3' + releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3' } task androidJavadocs(type: Javadoc) { diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java index 3c21fd30..8b6e3cd5 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java @@ -29,6 +29,9 @@ import android.graphics.Typeface; import android.os.Handler; import android.preference.PreferenceManager; import android.util.Log; + +import com.squareup.leakcanary.LeakCanary; + import org.acra.ACRA; import org.acra.ReportingInteractionMode; import org.acra.annotation.ReportsCrashes; @@ -43,11 +46,12 @@ import org.solovyev.android.calculator.wizard.CalculatorWizards; import org.solovyev.android.wizard.Wizards; import org.solovyev.common.msg.MessageType; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; +import javax.annotation.Nonnull; + @ReportsCrashes(formKey = "", formUri = "https://serso.cloudant.com/acra-cpp/_design/acra-storage/_update/report", reportType = org.acra.sender.HttpSender.Type.JSON, @@ -121,6 +125,8 @@ public class CalculatorApplication extends android.app.Application implements Sh public void onCreate() { if (!BuildConfig.DEBUG) { ACRA.init(this); + } else { + LeakCanary.install(this); } if (!App.isInitialized()) {