proguard + crashlytics crash

2019-04-02 17:06发布

I have integrated Crashlytics in my project, Now when I enable proguard, App Crashes. Have tried to exclude all the classes from crashlytics with no success

File proguard-rules.pro file has the following

-keep class io.fabric.sdk.android.** { *; }
-keep interface io.fabric.sdk.android.** { *; }
-keep class com.digits.sdk.android.core.** { *; }
-keep interface com.digits.sdk.android.core.** { *; }
-keep class com.twitter.sdk.android.** { *; }
-keep interface com.twitter.sdk.android.** { *; }

-keep class io.fabric.** { *; }
-keep interface io.fabric.** { *; }
-keep class com.digits.** { *; }
-keep interface com.digits.** { *; }
-keep class com.twitter.** { *; }
-keep interface com.twitter.** { *; }
-keep class com.crashlytics.** { *; }
-keep interface com.crashlytics.** { *; }
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**

I am getting an error as

com.example.app E/Answers: Failed to submit events task
    java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@1d060ef0 rejected from java.util.concurrent.ScheduledThreadPoolExecutor@31c1ac69[Shutting down, pool size = 1, active threads = 0, queued tasks = 1, completed tasks = 9]
        at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2011)
        at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:793)
        at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:298)
        at java.util.concurrent.ScheduledThreadPoolExecutor.schedule(ScheduledThreadPoolExecutor.java:503)
        at java.util.concurrent.ScheduledThreadPoolExecutor.submit(ScheduledThreadPoolExecutor.java:602)
        at java.util.concurrent.Executors$DelegatedExecutorService.submit(Executors.java:593)
        at com.crashlytics.android.answers.AnswersEventsHandler.executeAsync(Unknown Source)
        at com.crashlytics.android.answers.AnswersEventsHandler.processEvent(Unknown Source)

I have also looked at crashlytics document and tried every possible combinations. can someone please guide me on this

1条回答
戒情不戒烟
2楼-- · 2019-04-02 18:01

From their documentation -

First of all, Fabric uses annotations internally, so add the following line to your configuration file:

-keepattributes *Annotation*

Next, in order to provide the most meaningful crash reports, add the following line to your configuration file:

-keepattributes SourceFile,LineNumberTable

If you are using custom exceptions, add this line so that custom exception types are skipped during obfuscation:

-keep public class * extends java.lang.Exception
查看更多
登录 后发表回答