【发布时间】:2016-04-07 19:12:21
【问题描述】:
在android studio上运行android应用时出现如下异常:
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/commons/collections/ArrayStack.class
并发现 commons-beanutils-1.8.0.jar 和 commons-collections-3.2.1.jar 都包含相同的类(org/apache/commons /collections/ArrayStack.class) 位于项目的外部库中。
我不知道为什么这两个 jar 包含在这里和我的 build.gradle 如下:
`apply plugin: java
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
tasks.withType(JavaCompile){
options.encoding="UTF-8"
}
repositories {
mavenCentral()
jcenter()
mavenLocal()
}
dependencies {
compile ('io.netty:netty-all:5.0.0.Alpha2')
compile ('org.springframework:spring-core:4.2.4.RELEASE')
compile ('org.springframework:spring-webmvc:4.2.4.RELEASE')
compile ('org.springframework:spring-jdbc:4.2.4.RELEASE')
compile ('org.springframework:spring-test:4.2.4.RELEASE')
compile ('org.springframework:spring-context:4.2.4.RELEASE')
compile ('org.springframework.data:spring-data-mongodb:1.8.2.RELEASE')
compile ('org.springframework.security:spring-security-core:4.0.3.RELEASE')
compile ('org.springframework.security:spring-security-web:4.0.3.RELEASE')
compile ('javax.servlet:javax.servlet-api:3.1.0')
compile ('org.mybatis:mybatis:3.3.0')
compile ('org.mybatis:mybatis-spring:1.2.3')
compile ('net.sf.json-lib:json-lib:2.4:jdk15')
compile ('c3p0:c3p0:0.9.1.2')
compile ('com.google.protobuf:protobuf-java:2.6.1')
compile ('mysql:mysql-connector-java:5.1.38')
compile ('org.mongodb:mongo-java-driver:3.2.0')
compile ('org.slf4j:slf4j-log4j12:1.7.2')
compile ('org.jasig.cas.client:cas-client-core:3.4.1')
compile ('commons-httpclient:commons-httpclient:3.1')
compile group: 'com.alibaba', name:'fastjson', version:'1.2.4'
testCompile ( 'junit:junit:4.12')
}`
如何解决此异常以及为什么下载并位于外部库中的 commons-beanutils-1.8.0.jar 和 commons-collection-3.2.1.jar ?提前感谢您的帮助。
【问题讨论】: