當我運行應用程序時出現這樣的錯誤。我在我的MainActivity中使用HttpClient,HttpEntity,HttpResponse和HttpPost ..所以我對gradle文件做了一些修改。之後,我得到這樣的錯誤。java.util.zip.ZipException:重複項:org/apache/http/ConnectionClosedException.class
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/http/ConnectionClosedException.class
我也包括multidex圖書館和org.apache.http.legacy.jar我app.but然後還我收到了同樣的錯誤。
的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.test1"
minSdkVersion 15
targetSdkVersion 23
multiDexEnabled true
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
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.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:multidex:1.0.1'
compile files('libs/org.apache.http.legacy.jar')
compile 'org.apache.httpcomponents:httpmime:4.5.1'
}
我知道這個問題已經被問了很多次,但沒有解決方案的工作對我來說.. 誰能幫我解決這一個。
你加入這個類組織/阿帕奇/ HTTP/ConnectionClosedException兩次加這裏面的android部分。檢查你的依賴關係。 –
我檢查了..我只添加了一次..甚至我評論'編譯文件('libs/org.apache.http.legacy.jar')'在依賴關係中的這一行,因爲我已經將jar文件複製到libs文件夾中。 。但是,我也得到同樣的錯誤。 –
@ GabrieleMariotti可能是什麼問題..? –