From ab5aebeda3388ec776c34130cf9039ae4f623562 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Mon, 27 Jan 2020 23:24:04 +0530 Subject: Improved debugging tools (#620) * Add WhatTheStack * Add leakcanary * Codestyle nit * Support snapshot builds for debug tooling Signed-off-by: Harsh Shandilya --- app/build.gradle | 9 +++++++++ app/src/main/java/com/zeapo/pwdstore/Application.kt | 4 ++++ 2 files changed, 13 insertions(+) (limited to 'app') diff --git a/app/build.gradle b/app/build.gradle index fdc2347d..0d10903b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -50,11 +50,13 @@ android { release { minifyEnabled = true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + buildConfigField 'boolean', 'ENABLE_DEBUG_FEATURES', isSnapshot() ? 'true' : 'false' } debug { applicationIdSuffix = '.debug' versionNameSuffix = '-debug' minifyEnabled = false + buildConfigField 'boolean', 'ENABLE_DEBUG_FEATURES', 'true' } } @@ -98,6 +100,13 @@ dependencies { implementation deps.third_party.openpgp_ktx implementation deps.third_party.ssh_auth implementation deps.third_party.timber + implementation deps.third_party.whatthestack + + if (isSnapshot()) { + implementation deps.third_party.leakcanary + } else { + debugImplementation deps.third_party.leakcanary + } // Testing-only dependencies androidTestImplementation deps.testing.junit diff --git a/app/src/main/java/com/zeapo/pwdstore/Application.kt b/app/src/main/java/com/zeapo/pwdstore/Application.kt index 97b5ae69..aea46e07 100644 --- a/app/src/main/java/com/zeapo/pwdstore/Application.kt +++ b/app/src/main/java/com/zeapo/pwdstore/Application.kt @@ -4,6 +4,7 @@ */ package com.zeapo.pwdstore +import com.haroldadmin.whatthestack.WhatTheStack import timber.log.Timber @Suppress("Unused") @@ -12,5 +13,8 @@ class Application : android.app.Application() { override fun onCreate() { super.onCreate() Timber.plant(Timber.DebugTree()) + if (BuildConfig.ENABLE_DEBUG_FEATURES) { + WhatTheStack(this).init() + } } } -- cgit v1.2.3