ProGuard和CrashlyticsProGuard、Crashlytics

2023-09-07 22:12:11 作者:祢.硪锝辛福呢?

我们已经在我们的Andr​​oid应用程序添加Crashlytics,我们正在使用ProGuard。因此,随着crashlytics文件说,我们已经添加了以下code在我们的ProGuard配置文件:

We have added Crashlytics in our android application, and we are using proguard. So, as the crashlytics documentation says, we have added the following code in our proguard configuration file:

-keep class com.crashlytics.** { *; }
-keep class com.crashlytics.android.**
-keepattributes SourceFile,LineNumberTable *Annotation*

可惜的是,当我们签署APK,我们得到以下错误:

Unfortunatelly, when we sign the APK we get the following error:

java.io.IOException: proguard.ParseException: Unknown option '*Annotation*' 

什么是我们做错了什么?

What are we doing wrong?

在此先感谢

推荐答案

试试这个ProGuard的规则

Try This ProGuard rules

# Crashlytics
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**
-keepattributes SourceFile,LineNumberTable,*Annotation*
-keep class com.crashlytics.android.**

和请确保是到位。