Gradle在使用Facebook SDK、Fresco库和Retrofit时失败了?

4

有人尝试过实现Facebook SDK、Fresco库和Retrofit吗?我的gradle失败了,显示存在关于bolts的重复项。

 Error:Execution failed for task   ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException:  java.util.zip.ZipException: duplicate entry:    bolts/AggregateException.class

这是我的Gradle失败。我尝试使用Fresco替换OkHttp,但仍然遇到上述问题。
dependencies {
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
    compile 'com.facebook.fresco:fresco:0.9.0'
    compile 'com.facebook.fresco:imagepipeline-okhttp:0.9.0'
    compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
    compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
    compile 'com.android.support:multidex:1.0.1'
}

看看这里是否有任何帮助:https://dev59.com/zl4b5IYBdhLWcg3wsDh3 - OneCricketeer
我尝试了那个链接,但没有成功。还有其他的想法吗? - Zookey
我在评论中看到了Gradle项目中的“exclude”关键字,这是在Bolts项目中的。我已经看到了几篇关于该库与某些内容冲突的帖子,但不确定是什么... - OneCricketeer
尝试使用以下链接:https://dev59.com/JVwX5IYBdhLWcg3w8TMf - mahmoud moustafa
1个回答

8

以下是对我有帮助的内容:

compile ('com.facebook.fresco:fresco:0.9.0+'){
    exclude group: 'com.parse.bolts', module: 'bolts-applinks';
    exclude module: 'bolts-android';
    exclude group: 'com.parse.bolts', module: 'bolts-tasks';
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接