2

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]

  • 1
    Getting same error bro from the last couple of days...couldn't find solution, http://stackoverflow.com/questions/43094195/cant-generate-signed-apk-in-android-studio-java-io-ioexception – Abhi Mar 30 '17 at 06:40
  • Have you tried to exclude the io.branch 'answers-shim' module in the gradle setting – Ilanthirayan Paramanathan Mar 30 '17 at 06:43
  • Yes, but still getting the error. Actually, I'm also using Realm; do I have to exclude some module from its library too? Check my question, I've already shared the link of my question. – Abhi Mar 30 '17 at 06:51
  • Try excluding 'answers-shim' from 'io.branch' in the gradle file and add necessary proguard entries for dagger and crashlytics. – nnn Mar 30 '17 at 07:11
  • Since those are warning, you can add below line to ignore those warning while you are building your gradle. `-dontwarn com.crashlytics.android.answers.shim.**` – Ilanthirayan Paramanathan Mar 30 '17 at 07:12

1 Answers1

2

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.**