Couldn't build android gradle with Crashlytics 2.6.7 and io.branch.sdk.android.library:2+ while proguard enable?

My Gradle Settings:

compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
    transitive = true;
}

compile('io.branch.sdk.android:library:2.+') {
    transitive = true;
}

with above crashlytics & branch.io try to build gradle with proguard enabled. I am getting below error.

Warning:Exception while processing task java.io.IOException: Can't write [/Users/Documents/test/andriod-test/app/build/intermediates/transforms/proguard/production/release/jars/3/1f/main.jar] (Can't read [/Users/Documents/test/andriod-test/app/build/intermediates/classes/production/release(;;;;;;**.class)] (Can't read [com] (Can't read [crashlytics] (Can't read [android] (Can't read [answers] (Can't read [shim] (Can't read [R.class] (Duplicate zip entry [com/crashlytics/android/answers/shim/R.class])))))))) Error:java.lang.RuntimeException: Job failed, see logs for details Error:java.io.IOException: Can't write [/Users/Documents/test/andriod-test/app/build/intermediates/transforms/proguard/production/release/jars/3/1f/main.jar] (Can't read [/Users/Documents/test/andriod-test/app/build/intermediates/classes/production/release(;;;;;;**.class)] (Can't read [com] (Can't read [crashlytics] (Can't read [android] (Can't read [answers] (Can't read [shim] (Can't read [R.class] (Duplicate zip entry [com/crashlytics/android/answers/shim/R.class])))))))) Error:java.io.IOException: Can't read [/Users/Documents/test/andriod-test/app/build/intermediates/classes/production/release(;;;;;;**.class)] (Can't read [com] (Can't read [crashlytics] (Can't read [android] (Can't read [answers] (Can't read [shim] (Can't read [R.class] (Duplicate zip entry [com/crashlytics/android/answers/shim/R.class]))))))) Error:java.io.IOException: Can't read [com] (Can't read [crashlytics] (Can't read [android] (Can't read [answers] (Can't read [shim] (Can't read [R.class] (Duplicate zip entry [com/crashlytics/android/answers/shim/R.class])))))) Error:java.io.IOException: Can't read [crashlytics] (Can't read [android] (Can't read [answers] (Can't read [shim] (Can't read [R.class] (Duplicate zip entry [com/crashlytics/android/answers/shim/R.class]))))) Error:java.io.IOException: Can't read [android] (Can't read [answers] (Can't read [shim] (Can't read [R.class] (Duplicate zip entry [com/crashlytics/android/answers/shim/R.class])))) Error:java.io.IOException: Can't read [answers] (Can't read [shim] (Can't read [R.class] (Duplicate zip entry [com/crashlytics/android/answers/shim/R.class]))) Error:java.io.IOException: Can't read [shim] (Can't read [R.class] (Duplicate zip entry [com/crashlytics/android/answers/shim/R.class])) Error:java.io.IOException: Can't read [R.class] (Duplicate zip entry [com/crashlytics/android/answers/shim/R.class]) Error:java.io.IOException: Duplicate zip entry [com/crashlytics/android/answers/shim/R.class]

Upvotes: 2

Views: 394

Answers (1)

since the error message is indicating that some of the 'answers-shim' classes duplicate, one is from crashlytics and another one from io.branch itself, What I have done is, exclude the io.branch module 'answers-shim' by editting the gradle file below.

compile('io.branch.sdk.android:library:2.+') {
    transitive = true;
    exclude module: 'answers-shim'
}

Exclude 'answer-shim' module to the io.branch.sdk.library gradle settings as shown above.

After that in your proguard file add the below line as well to ignore the warnings:

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

Upvotes: 2

Related Questions