微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Proguard混淆的协程异常

如何解决Proguard混淆的协程异常

出于某种原因,亲卫队混淆了协程异常,例如 Non-fatal Exception: m.a.l1 Job was cancelled,当不应该

app / proguard-rules.pro

-renamesourcefileattribute SourceFile
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod

##--------------- Coroutines  ----------
# ServiceLoader support
-keepnames class kotlinx.coroutines.internal.MaindispatcherFactory {}
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
-keepnames class kotlinx.coroutines.android.AndroidExceptionPreHandler {}
-keepnames class kotlinx.coroutines.android.AndroiddispatcherFactory {}

# Most of volatile fields are updated with AFU and should not be mangled
-keepclassmembernames class kotlinx.** {
    volatile <fields>;
}

# Same story for the standard library's SafeContinuation that also uses atomicreferenceFieldUpdater
-keepclassmembernames class kotlin.coroutines.SafeContinuation {
    volatile <fields>;
}
...

kotlinx-coroutines-android版本= 1.3.0
gradle_version = '3.4.1'

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。