看板 AndroidDev 關於我們 聯絡資訊
大家好, 自從eclipse移轉到android studio後就從沒編譯成功過 不斷出現java.util.zip.ZipException的錯誤 如: Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/http/ConnectionClosedException.class 我的dependencies: 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:support-v4:23.0.0' compile 'com.android.support:appcompat-v7:23.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' } 要如何找出重複的檔案? 位置在哪? 如何處置重複的檔案? 煩惱已久 謝謝大家! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.225.108.56 ※ 文章網址: https://www.ptt.cc/bbs/AndroidDev/M.1467208544.A.725.html
ssccg: org/apache/http/ConnectionClosedException.class 06/30 00:34
ssccg: ↑重複的,就不要放有重複class的jar檔/dependency 06/30 00:37
HelloJimmy: 可是我需要import不同namespace否則報錯 但偏偏不同 06/30 21:18
HelloJimmy: jar檔有重複的class,如何處理? 06/30 21:19
y3k: 我記得可以針對指定的dependency去exclude某個class 07/01 07:09
ssccg: exclude是最後手段了,有適當dependency管理的library是不 07/01 09:26
ssccg: 該有同一個class在兩個jar檔,除了light版跟完整版這種以外 07/01 09:27
ssccg: apache httpmime就已經有depend httpclient > httpcore 07/01 09:33