Ignoring annoying bug with Samsung devices on 4.2.2 (#57)

* Updated gradle version.

* Fixed #55. Ignoring annoying non fatal bug on Samsung devices.
This commit is contained in:
Amine Bou
2017-07-30 18:37:44 +02:00
committed by GitHub
parent acf6995c2d
commit ba120b1e0b
3 changed files with 16 additions and 2 deletions

View File

@ -31,6 +31,8 @@ class MyApp : MultiDexApplication() {
initTheme()
tryToHandleBug()
}
private fun initAmplify() {
@ -82,4 +84,16 @@ class MyApp : MultiDexApplication() {
.setSharedPreferences(PreferenceManager.getDefaultSharedPreferences(this))
.initialize()
}
private fun tryToHandleBug() {
val oldHandler = Thread.getDefaultUncaughtExceptionHandler()
Thread.setDefaultUncaughtExceptionHandler { thread, e ->
if (e is java.lang.NoClassDefFoundError && e.stackTrace.asList().any { it.toString().contains("android.view.ViewDebug") })
Unit
else
oldHandler.uncaughtException(thread, e)
}
}
}