Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Absolute last chance to log an exception and it's stack trace to logcat for an Android app.
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
You can’t perform that action at this time.