2015-10-24 44 views
3

我收到以下错误。过去两天我没有试图解决这个问题,但没有任何解决方案能够解决问题。 错误:执行任务':app:packageAllDebugClassesForMultiDex'失败。java.util.zip.ZipException:重复项:org/apache/http/HttpMessage.class

java.util.zip.ZipException: duplicate entry: org/apache/http/HttpMessage.class here is my build.gradle(app)

apply plugin: 'com.android.application' 


android { 
compileSdkVersion 23 
buildToolsVersion '23.0.0' 

defaultConfig { 
    applicationId "com.mycompany.newlogin" 
    minSdkVersion 15 
    targetSdkVersion 22 
    versionCode 1 
    versionName "1.0" 
    multiDexEnabled true 
} 

buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
productFlavors { 

} 
useLibrary 'org.apache.http.legacy' 
} 
dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
testCompile 'junit:junit:4.12' 
compile 'com.android.support:multidex:1.0.0' 
compile 'com.google.guava:guava-jdk5:17.0' 
compile 'com.android.support:appcompat-v7:23.0.1' 
compile 'com.android.support:design:23.0.1' 
compile 'org.apache.httpcomponents:httpcore:4.4.1' 
compile 'org.apache.httpcomponents:httpclient:4.5' 
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2' 

}

请帮助我。谢谢你提前。

回答

2

看看你引用的包,org.jbundle.util.osgi.wrapped.org.apache.http.client似乎至少包含一些httpcore类,特别是在你的错误信息中提到的那个类。所以我猜你根本不能也不应该把两者都用作依赖关系,但只有你真正需要的依赖关系。

5

我也有这种错误,我解决了这个在您的build.gradle(app)去除httpcore

删除这些行

compile 'org.apache.httpcomponents:httpcore:4.4.1' 
compile 'org.apache.httpcomponents:httpclient:4.5' 

,然后加入最新版的Apache库您build.gradle(app)

compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1' 
+1

你恩惠的好友。屠妖节快乐 – lRadha

0

的以下库引起冲突,我从build.gradle

compile 'com.loopj.android:android-async-http:1.4.9' 
    compile 'org.apache.httpcomponents:httpcore:4.4.1' 

,我只还剩下:

compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2' 
相关问题