摇篮重复的条目:java.util.zip.ZipException [英] Gradle Duplicate Entry: java.util.zip.ZipException

查看:310
本文介绍了摇篮重复的条目:java.util.zip.ZipException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过集成的Maven仓库的Zendesk移动SDK到我的项目,它不会建了。它具有某种与毕加索库的冲突,我使用的。我在生成过程中出现此错误:

I integrated the Zendesk mobile sdk through its maven repository into my project and it wouldn't build anymore. It has some kind of a clash with picasso library that i am using. I get this error during the build:

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: com/squareup/picasso/Action$RequestWeakReference.class 

我跑 ../ gradlew依赖上的应用程序文件夹,这是我在zendesk模块发现:

I ran ../gradlew dependencies on the app folder and this is what i found under zendesk module:

\--- com.zendesk:sdk:1.0.0.1
     +--- com.squareup.retrofit:retrofit:1.4.1
     |    \--- com.google.code.gson:gson:2.2.4
     +--- com.squareup.picasso:picasso:2.3.2
     +--- com.android.support:support-v4:20.0.+ -> 21.0.3 (*)
     \--- com.android.support:appcompat-v7:20.0.+ -> 21.0.3 (*)

所以zendesk还采用毕加索,但是一个不同的版本比我有我的项目。我试图从zendesk不包括毕加索这样的:

So zendesk is also using picasso but a different version than what i have in my project. I tried excluding picasso from zendesk like this:

compile (group: 'com.zendesk', name: 'sdk', version: '1.0.0.1'){
            exclude group: 'com.squareup.picasso'
        }

但是这将导致在该应用的其它部件运行时异常。我得到一个NoDefFoundError一类完全无关的库。
没有任何一个有任何想法如何解决这个问题?

but this causes runtime exceptions in other components of the app. I get a NoDefFoundError for a class totally unrelated to the libraries.
Does any one have any idea how to get around this problem ?

推荐答案

当您添加 com.android.support:multidex 依赖你其实可以说是一些依赖与冲突其他依赖。

我解决了它是:
---------------
1,搜索类,在你情况下,RequestWeakReference.class(在AndroidStudio只是按Ctrl + N在Windows或CMD-O在Mac)
2.请参阅该JAR包含它 - 机器人工作室将它写在弹出
。 3.排除它的所有版本,例如:

When you added the com.android.support:multidex dependency you actually added some dependencies that collide with other dependencies.

I solved it by:
---------------
1. searching for the class, in you case the "RequestWeakReference.class" (in AndroidStudio just hit Ctrl+N on Windows or CMD-O on Mac)
2. See which jar contains it - Android Studio will write it in the popup.
3. Exclude it from all builds, for example:

android {
     configurations{
        all*.exclude module: 'servlet-api'
    }
}

这篇关于摇篮重复的条目:java.util.zip.ZipException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆