关于错误java.util.zip.ZipException: duplicate entry during packageAllDebugClassesForMultiDex
2016-03-16 13:29
531 查看
在导入几个外部jar包至AS中lib文件夹,并add as library后,build.gradle文件中生成:
编译报错如标题。
解决办法:
http://stackoverflow.com/questions/26966843/java-util-zip-zipexception-duplicate-entry-during-packagealldebugclassesformult
My understanding is that there are duplicate references to the same API (Likely different version numbers). It should be reasonably easy to debug when building from the command line.
Try ./gradlew yourBuildVariantName –debug from the command line.
The offending item will be the first failure. An example might look like:
14:32:29.171 [INFO] [org.gradle.api.Task] INPUT: /Users/mydir/Documents/androidApp/BaseApp/build/intermediates/exploded-aar/theOffendingAAR/libs/google-play-services.jar
14:32:29.171 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ‘:BaseApp:packageAllyourBuildVariantNameClassesForMultiDex’
14:32:29.172 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :BaseApp:packageAllyourBuildVariantNameClassesForMultiDex FAILED’
In the case above, the aar file that I’d included in my libs directory (theOffendingAAR) included the Google Play Services jar (yes the whole thing. yes I know.) file whilst my BaseApp build file utilised location services:
You can safely remove the offending item from your build file(s), clean and rebuild (repeat if necessary).
简单说就是移除compile ‘com.google.android.gms:play-services-location:xxx’来解决。
dependencies { // lib编译jar包 compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:recyclerview-v7:23.1.1' compile('io.socket:socket.io-client:0.7.0') { exclude group: 'org.json', module: 'json' } compile 'com.google.android.gms:play-services:8.4.0' compile project(':library') compile files('src/main/libs/universal-image-loader-1.9.4.jar') compile files('src/main/libs/json-lib-2.4-jdk15.jar') compile files('src/main/libs/commons-collections-3.2.2.jar') compile files('src/main/libs/ezmorph-1.0.6.jar') compile files('src/main/libs/commons-beanutils-1.7.0.jar') compile files('src/main/libs/commons-lang-2.5.jar') compile files('src/main/libs/commons-logging.jar') }
编译报错如标题。
解决办法:
http://stackoverflow.com/questions/26966843/java-util-zip-zipexception-duplicate-entry-during-packagealldebugclassesformult
My understanding is that there are duplicate references to the same API (Likely different version numbers). It should be reasonably easy to debug when building from the command line.
Try ./gradlew yourBuildVariantName –debug from the command line.
The offending item will be the first failure. An example might look like:
14:32:29.171 [INFO] [org.gradle.api.Task] INPUT: /Users/mydir/Documents/androidApp/BaseApp/build/intermediates/exploded-aar/theOffendingAAR/libs/google-play-services.jar
14:32:29.171 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ‘:BaseApp:packageAllyourBuildVariantNameClassesForMultiDex’
14:32:29.172 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :BaseApp:packageAllyourBuildVariantNameClassesForMultiDex FAILED’
In the case above, the aar file that I’d included in my libs directory (theOffendingAAR) included the Google Play Services jar (yes the whole thing. yes I know.) file whilst my BaseApp build file utilised location services:
compile 'com.google.android.gms:play-services-location:6.5.87'
You can safely remove the offending item from your build file(s), clean and rebuild (repeat if necessary).
简单说就是移除compile ‘com.google.android.gms:play-services-location:xxx’来解决。
相关文章推荐
- java中volatile关键字的含义
- Spring AOP 自定义注解记录操作日志
- java笔试题(三)
- 关于Spring定时任务(定时器)用法
- 【springmvc (六)】 使用log4j 日志
- 如何利用JDK编译和运行应用程序
- 【Struts2进阶】Struts2拦截器实现基于Url的权限管理
- Eclipse 搭建gradle环境
- eclipse下,tomact jar包存在 但是无法解析导入 javax.servlet 的问题与解析
- plupload上传插件在SpringMVC中的整合
- springmvc.xml文件头的描述和请求路径前缀和后缀的解析
- JDK和JRE的区别是什么?它们各自有什么作用
- 【javacript】获得点击的标签
- java线程(3)-多线程死锁
- 有用的java代码
- java调用外部程序实时输出
- 用eclipse创建maven项目
- java 接口以及抽象类 一些知识点
- struts2自己定义拦截器
- java截取指定字符串中的某段字符如何实现?