在 android gradle 中排除模块 'answer-shim' 之后 io.branch.sdk 无法使用混淆器构建

After exclude module 'answer-shim' in the android gradle for io.branch.sdk couldn't build with proguard

当尝试使用 proguard 构建发布版本时,启用低于警告并且无法成功构建 APK。

Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.KitEvent
Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.AnswersOptionalLogger
Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.KitEventLogger
Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.AnswersOptionalLogger
Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.KitEventLogger
Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.KitEvent
Warning:there were 14 unresolved references to classes or interfaces.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:java.lang.RuntimeException: Job failed, see logs for details
Error:java.io.IOException: Please correct the above warnings first.

添加 -dontwarn com.crashlytics.android.answers.shim.**

到混淆文件

如果你想从 Proguard 中排除 Crashlytics,你可以使用这两行

-keep class com.crashlytics.** { *; } -dontwarn com.crashlytics.**

查看 Fabric 的 Proguard page