2015-10-06 29 views
13

對不起,如果我問了一個重複的問題,但我找不到這個錯誤的解決方案。我瀏覽了stackoverflow,gradle站點,android博客,谷歌搜索,但幾個小時沒有工作解決方案。我是一名Android初學者,所以我不確定自己是否錯過了其他職位。Android:app:transformClassesWithJarMergingForDebug FAILED - ZipException:重複條目

apply plugin: 'com.android.application' 
apply plugin: 'com.google.gms.google-services' 

android { 
     compileSdkVersion 23 
     buildToolsVersion "23.0.0" 

defaultConfig { 
    minSdkVersion 14 
    targetSdkVersion 22 
    multiDexEnabled true 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
} 

dependencies { 
compile 'com.android.support:appcompat-v7:22.2.1.' 
compile 'com.squareup.retrofit:retrofit:2.0.0-beta1' 
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta1' 
compile 'com.android.support:recyclerview-v7:22.2.1.' 
compile 'com.android.support:cardview-v7:22.2.1.' 
compile 'com.squareup.picasso:picasso:2.5.2' 
compile 'com.pnikosis:materialish-progress:1.7' 
compile 'com.jakewharton:butterknife:7.0.1' 
compile 'com.google.android.gms:play-services:8.1.0' 
compile files('libs/android-support-v4-22.2.1.jar') 
compile files('libs/applovin-sdk-6.0.1.jar') 
compile files('libs/appodeal-1.13.1.jar') 
compile files('libs/chartboost-5.2.0.jar') 
compile files('libs/my-target-4.0.13.jar') 
compile files('libs/unity-ads-1.4.7.jar') 
} 

該項目,直到我從添加一些appodeal庫(編譯那些文件行)正常工作。我試圖建立這個項目,但是Gradle給出了錯誤。關於重複相同的異常的

:app:transformClassesWithJarMergingForDebug'. 
com.android.build.transform.api.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/widget/RecyclerView$ItemDecoration.class 

也有2個錯誤入門不知道爲什麼我讓他們:android/support/v4/PrintKitKat.classandroid/support/multidex/MultiDex$V14.class

我試圖升級gradle,無效並重新啓動以清除緩存,省略依賴關係,然後重建/清理項目,找到潛在的重複模塊進行排除,併爲那些搜索項目.class但我沒有發現重複。

+2

也許你的罐子一個已經包含RecyclerView庫的.jar /支持Multidex的.jar /支持V4的.jar儘量不要自行申報他們。如果它有幫助,那麼你需要找到一種方法來讓Gradle「合併」重複的依賴關係。不幸的是看你的依賴列表我不能建議哪個庫也可以依賴於recyclerview/multidex-support/support-v4。 – Lingviston

+4

你可以執行**。/ gradlew app:dependencies **並附加結果。 – Oleksandr

+0

對於遲到的回覆,我很抱歉,我遲遲沒能進入到stackoverflow。我再次檢查了外部庫樹作爲@Lingviston建議,並看到有一些重複,因爲我更新了一些依賴關係的版本,所以gradle在不同的文件夾中下載了2個版本。我認爲它工作正常,因爲我沒有添加** multiDexEnable true **。但是當我添加更多的庫,並且該項目超過了65k的限制(我認爲是這樣),那麼我必須使用_multi dexing_並且gradle沒有「合併」它們。感謝Alexandr的命令,它給了非常全面的依賴樹視圖。 –

回答

13

您可以測試將這一對目錄的根在終端

./gradlew clean 
+0

我手動刪除重複,但。如果只有你已經發布了這個更快。 案件解決,謝謝:D –

相關問題