From ba120b1e0b7cceb4e2896ab12b291e7a01e14525 Mon Sep 17 00:00:00 2001 From: Amine Bou Date: Sun, 30 Jul 2017 18:37:44 +0200 Subject: [PATCH] Ignoring annoying bug with Samsung devices on 4.2.2 (#57) * Updated gradle version. * Fixed #55. Ignoring annoying non fatal bug on Samsung devices. --- CHANGELOG.md | 2 +- .../java/apps/amine/bou/readerforselfoss/MyApp.kt | 14 ++++++++++++++ build.gradle | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26dda25..a08cd4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -**1.5.1.9** +**1.5.1.9/10/11** - Hiding the unread badge when marking all items as read. diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/MyApp.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/MyApp.kt index 4c5edae..2d1fc51 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/MyApp.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/MyApp.kt @@ -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) + } + + } } \ No newline at end of file diff --git a/build.gradle b/build.gradle index 171ce35..cbda3d1 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.0.0-alpha5' + classpath 'com.android.tools.build:gradle:3.0.0-alpha8' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong