Commit 47c30459 authored by topjohnwu's avatar topjohnwu

Log full stack trace for unhandled exception

parent dd50c19b
...@@ -27,6 +27,7 @@ import com.topjohnwu.superuser.Shell ...@@ -27,6 +27,7 @@ import com.topjohnwu.superuser.Shell
import org.koin.android.ext.koin.androidContext import org.koin.android.ext.koin.androidContext
import org.koin.core.context.startKoin import org.koin.core.context.startKoin
import timber.log.Timber import timber.log.Timber
import kotlin.system.exitProcess
open class App() : Application() { open class App() : Application() {
...@@ -49,13 +50,19 @@ open class App() : Application() { ...@@ -49,13 +50,19 @@ open class App() : Application() {
else -> null 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) { override fun attachBaseContext(base: Context) {
// Basic setup // Basic setup
if (BuildConfig.DEBUG) if (BuildConfig.DEBUG)
MultiDex.install(base) MultiDex.install(base)
Timber.plant(Timber.DebugTree())
// Some context magic // Some context magic
val app: Application val app: Application
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment