From 8ae7ccbfc9209805d574793eef7bc6c7de2021ac Mon Sep 17 00:00:00 2001 From: kr328 Date: Sun, 13 Jun 2021 12:32:34 +0800 Subject: [PATCH] Chore: add coroutine-android proguard rules --- app/proguard-rules.pro | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 0d5ce2d4..bdc9a3ad 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -31,3 +31,29 @@ public static void checkParameterIsNotNull(...); public static void checkNotNullParameter(...); } + +# Kotlin Coroutine +# Allow R8 to optimize away the FastServiceLoader. +# Together with ServiceLoader optimization in R8 +# this results in direct instantiation when loading Dispatchers.Main +-assumenosideeffects class kotlinx.coroutines.internal.MainDispatcherLoader { + boolean FAST_SERVICE_LOADER_ENABLED return false; +} + +-assumenosideeffects class kotlinx.coroutines.internal.FastServiceLoaderKt { + boolean ANDROID_DETECTED return true; +} + +-keep class kotlinx.coroutines.android.AndroidDispatcherFactory {*;} + +# Disable support for "Missing Main Dispatcher", since we always have Android main dispatcher +-assumenosideeffects class kotlinx.coroutines.internal.MainDispatchersKt { + boolean SUPPORT_MISSING return false; +} + +# Statically turn off all debugging facilities and assertions +-assumenosideeffects class kotlinx.coroutines.DebugKt { + boolean getASSERTIONS_ENABLED() return false; + boolean getDEBUG() return false; + boolean getRECOVER_STACK_TRACES() return false; +} \ No newline at end of file