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

查看:24
本文介绍了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

我在这里此处.但我想我需要更多帮助,因为它不会消失.我已将异常添加到我的 build.gradle 文件中的几乎所有内容中,包括用于踢球的实际支持 4v 依赖项,但仍然收到此错误.由于包含的项目,我还有多个 build.gradle 文件吗?似乎项目 build.gradle 文件可以忽略,我只需要将异常添加到模块 build.gradle 文件中?(当有人说要在 build.gradle 文件中添加一些东西时,这很烦人,我并不总是确定是哪个)

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:

我的应用程序:

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'
    }
}

脸书:

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'
    }
}

还有一个 apptentive 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

如果有一种方法可以查看重复项的来源,那就太好了,我无法通过快速的谷歌搜索找到任何内容.

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天全站免登陆