无法生成签名的apk:java.util.zip.zipexception:重复输入

  • 本文关键字:zipexception zip util java apk android
  • 更新时间 :
  • 英文 :


我试图构建我的Android项目。当我重建项目时,只有很少的警告没有错误。但是,当我尝试生成签名的APK时,它显示以下错误:

错误:任务执行失败':app:packageAllReleaseclassesformultidex'。java.util.zip.zipexception:重复输入:org/apache/http/connectionClosedcectection.class

我知道ConnectionClosedexception.class在我的依赖项中是重复的,但我找不到它。任何人都知道如何解决这个问题吗?build.gradle中的依赖项如下:

dependencies {
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.android.gms:play-services:9.0.2'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'org.apache.httpcomponents:httpcore:4.4.5'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.android.support:support-v13:24.0.0'
compile files('libs/httpmime-4.2.jar')
compile files('libs/android-support-v4.jar')} 

非常感谢〜

2016.06.29调整依赖项后:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services-location:9.0.2'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'org.apache.httpcomponents:httpcore:4.4.5'
compile 'org.apache.httpcomponents:httpmime:4.5.2'
compile 'com.android.support:support-v4:23.0.0'}

错误变为:

Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'. >com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/http/entity/mime/HttpMultipart$1.class

任何人都知道如何检查哪个依赖库与其他任何库?

始终尝试使用Maven依赖性来防止重复项,因此请替换

compile files('libs/httpmime-4.2.jar')

compile 'org.apache.httpcomponents:httpmime:4.5.2'

相关内容

最新更新