2

我的 Gradle 设置:

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

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

使用上面的 crashlytics & branch.io 尝试在启用 proguard 的情况下构建 gradle。我得到以下错误。

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]

4

1 回答 1

2

由于错误消息表明某些“answers-shim”类重复,一个来自 crashlytics,另一个来自 io.branch 本身,我所做的是通过编辑排除 io.branch 模块“answers-shim”下面的 gradle 文件。

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

如上所示,将 'answer-shim' 模块排除到 io.branch.sdk.library gradle 设置中。

之后在您的 proguard 文件中添加以下行以忽略警告:

-dontwarn com.crashlytics.android.answers.shim.**
于 2017-03-30T06:37:42.367 回答