diff --git a/app/src/main/java/io/legado/app/App.kt b/app/src/main/java/io/legado/app/App.kt index 5ecda4c4a..a156f1b41 100644 --- a/app/src/main/java/io/legado/app/App.kt +++ b/app/src/main/java/io/legado/app/App.kt @@ -17,12 +17,16 @@ import io.legado.app.help.ThemeConfig.applyDayNight import io.legado.app.help.http.cronet.CronetLoader import io.legado.app.utils.LanguageUtils import io.legado.app.utils.defaultSharedPreferences +import timber.log.Timber class App : MultiDexApplication() { override fun onCreate() { super.onCreate() CrashHandler(this) + if (BuildConfig.DEBUG) { + Timber.plant(Timber.DebugTree()) + } //预下载Cronet so CronetLoader.preDownload() LanguageUtils.setConfiguration(this) diff --git a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt index 3d3049585..e0b48cae4 100644 --- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt @@ -13,6 +13,7 @@ import io.legado.app.utils.* import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.withContext import splitties.init.appCtx +import timber.log.Timber import java.io.File /** @@ -568,8 +569,10 @@ object ReadBookConfig { BitmapUtils.decodeBitmap(curBgStr(), width, height) ) } + } catch (e: OutOfMemoryError) { + Timber.e(e) } catch (e: Exception) { - e.printOnDebug() + Timber.e(e) } return bgDrawable ?: ColorDrawable(appCtx.getCompatColor(R.color.background)) }