From 47c3045980aae96a192c3bd03b56c40b8d868019 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Tue, 14 Jan 2020 20:14:20 +0800 Subject: [PATCH] Log full stack trace for unhandled exception --- app/src/main/java/com/topjohnwu/magisk/core/App.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/core/App.kt b/app/src/main/java/com/topjohnwu/magisk/core/App.kt index 7d59c20f2..89d40442c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/App.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/App.kt @@ -27,6 +27,7 @@ import com.topjohnwu.superuser.Shell import org.koin.android.ext.koin.androidContext import org.koin.core.context.startKoin import timber.log.Timber +import kotlin.system.exitProcess open class App() : Application() { @@ -49,13 +50,19 @@ open class App() : Application() { else -> null } } + + // Always log full stack trace with Timber + Timber.plant(Timber.DebugTree()) + Thread.setDefaultUncaughtExceptionHandler { _, e -> + Timber.e(e) + exitProcess(1) + } } override fun attachBaseContext(base: Context) { // Basic setup if (BuildConfig.DEBUG) MultiDex.install(base) - Timber.plant(Timber.DebugTree()) // Some context magic val app: Application