Created
January 16, 2018 22:38
-
-
Save banasiak/db1f59889162dcc6798659486a3e1014 to your computer and use it in GitHub Desktop.
Absolute last chance to log an exception and it's stack trace to logcat for an Android app.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyApplication extends MultiDexApplication { | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
if(BuildConfig.DEBUG) { | |
final Thread.UncaughtExceptionHandler handler = Thread.getDefaultUncaughtExceptionHandler(); | |
Thread.setDefaultUncaughtExceptionHandler( | |
(t, e) -> { | |
Timber.wtf(e); | |
handler.uncaughtException(t, e); | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment