java.util.zip.ZipException:重复项:android/support/v4/view/MotionEventCompatEclair.class [英] java.util.zip.ZipException: duplicate entry: android/support/v4/view/MotionEventCompatEclair.class

查看:180
本文介绍了java.util.zip.ZipException:重复项:android/support/v4/view/MotionEventCompatEclair.class的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是android studio的新手,正在尝试从eclipse导入项目,但是我感觉自己遇到了每一个可能的问题.我当前遇到的错误是:

I'm new to android studio and am trying to import a project from eclipse but I feel like i am running into every single problem possible. The error I'm currently getting is:

Error:Execution failed for task ':jobFlexwithInvoice:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/v4/view/MotionEventCompatEclair.class

对于此处

Ive seen similar answers to problems like here and here. But i think I need more help because its just not going away. I've added the exception to just about everything in my build.gradle file, including the actual support 4v dependency just for kicks, and am still getting this error. And also I have multiple build.gradle files because of included projects? It seems like the project build.gradle file can be ignored, I just have to add the exceptions to the module build.gradle files? (which is annoying when someone says to add something to the build.gradle file, im not always sure which one)

无论如何,这是我当前每个build.gradle文件的依赖项部分:

Anyway, here are the dependencies sections of each of my build.gradle files as they currently are:

myApp:

dependencies {
    compile ('com.android.support:multidex:1.0.0'){
        exclude module: 'support-v4'
    }
    compile project(':facebook') {
        exclude module: 'support-v4'
    }
    compile project(':apptentive')
    compile project(':androidsdkui'){
        exclude module: 'support-v4'
    }
    compile ('com.google.android.gms:play-services:+'){
        exclude module: 'support-v4'
    }
    compile files('libs/android-support-v13.jar') {
        exclude module: 'support-v4'
    }
    compile files('libs/DynamicPDF.jar')
    compile files('libs/picasso-2.5.0.jar')
    compile ('com.android.support:support-v4:22.0.0'){
        exclude module: 'support-v4'
    }
}

facebook:

dependencies {
    compile files('libs/bolts-android-1.2.1.jar')
    compile ('com.android.support:support-v4:22.0.0'){
        exclude module: 'support-v4'
    }
}

androidsdkui:

androidsdkui:

dependencies {
    compile files('libs/appboy.jar')
    compile ('com.android.support:support-v4:22.0.0'){
        exclude module: 'support-v4'
    }
}

还有一个适当的build.gradle文件,但没有任何依赖关系.在添加所有这些异常之前,我得到的错误与第一个链接中的错误相同,现在唯一的区别是它的android/support/v4/view/MotionEventCompatEclair.class而不是android/support/v4/util/TimeUtils.class

there is also an apptentive build.gradle file but it does not have any dependencies. Before adding all of these exceptions I was getting the same error as the one in the first link, now the only difference is its android/support/v4/view/MotionEventCompatEclair.class instead of android/support/v4/util/TimeUtils.class

如果也有办法查看重复的来源,那也很好,我无法通过快速的Google搜索找到任何东西.

If there is a way to see where the duplicates are coming from that would be great too, I was unable to find anything with a quick google search.

推荐答案

我更新了问题,以便您可以了解一些我做错事的方式.我的一些项目包括支持v4,但我并没有排除它们.从项目中排除事物的正确方法是:

I updated the question so you can see some of the ways I was doing things wrong. Some of my projects included support v4 and I wasn't excluding them right. The proper way to exclude things from projects is:

compile (project(':facebook')) {
    exclude module: 'support-v4'
}

编译后,必须在所有内容周围加上多余的括号.我认为排除文件中的内容同样如此

you have to put the extra set of parenthesis around everything after compile. Im assuming the same goes for excluding things from files

即.

compile file(myfile.jar)

将成为

compile (file(myfile.jar)) { 
    exclude module: 'support-v4'
}

这篇关于java.util.zip.ZipException:重复项:android/support/v4/view/MotionEventCompatEclair.class的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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