2017-05-20 53 views
0

花了将近一天的时间来搜索这个问题,但没有运气。它是由于依赖关系的冗余造成的。还没找到。java.util.zip.ZipException:重复条目:org/apache/commons/collections/ArrayStack.class

在我这里的build.gradle文件

apply plugin: 'com.android.application' 

android { 

defaultConfig { 
    applicationId "com.ujjwalmainali.univhub" 
    minSdkVersion 16 
    targetSdkVersion 22 
    versionCode 8 
    versionName "1.1" 
    multiDexEnabled true 
    vectorDrawables.useSupportLibrary = true 
} 

configurations { 
    all*.exclude group: 'commons-logging', module: 'commons-logging' 

} 


packagingOptions { 
    exclude 'META-INF/DEPENDENCIES' 
    exclude 'META-INF/NOTICE' 
    exclude 'META-INF/LICENSE' 
    exclude 'META-INF/LICENSE.txt' 
    exclude 'META-INF/NOTICE.txt' 
    exclude 'META-INF/ECLIPSE_.SF' 
    exclude 'META-INF/ECLIPSE_.RSA' 
} 


compileSdkVersion 25 
buildToolsVersion '25.0.2' 


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

repositories { 
    maven { url "https://raw.githubusercontent.com/smilefam/SendBird-SDK- 
Android/master/" } 
} 

dependencies { 
testCompile 'junit:junit:4.12' 

//iconify dependencies 



compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2' // (v4.5) 

compile 'com.facebook.android:facebook-android-sdk:[4,5)' 
compile 'com.sendbird.sdk:sendbird-android-sdk:3.0.25' 
compile 'com.miguelcatalan:materialsearchview:1.4.0' 
compile 'net.gotev:uploadservice-okhttp:3.0.3' 
compile 'com.jaredrummler:material-spinner:1.1.0' 
compile 'com.nononsenseapps:filepicker:4.1.0' 
compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.0' 
compile 'cn.pedant.sweetalert:library:1.3' 
compile 'de.hdodenhof:circleimageview:2.1.0' 
compile 'io.github.kobakei:ratethisapp:1.2.0' 
compile 'com.github.paolorotolo:appintro:4.1.0' 


//webview 
compile 'com.thefinestartist:finestwebview:1.2.7' 

//for android drawer 
compile('com.mikepenz:materialdrawer:[email protected]') { 
    transitive = true 
} 
compile ('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:[email protected]'){ 
    transitive=true 
} 


compile 'com.jakewharton:butterknife:8.5.1' 
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1' 
compile 'com.fasterxml.jackson.core:jackson-databind:2.5.3' 
compile 'com.squareup.picasso:picasso:2.5.2' 
compile 'com.googlecode.json-simple:json-simple:1.1' 
compile 'com.ogaclejapan.smarttablayout:library:[email protected]' 
compile 'com.ogaclejapan.smarttablayout:utils-v4:[email protected]' 
compile 'com.google.firebase:firebase-core:9.2.0' 
compile 'com.google.firebase:firebase-messaging:9.2.0' 
compile 'org.apache.commons:commons-lang3:3.4' 
compile 'commons-validator:commons-validator:1.4.1' 
//for the calender date picker supports other type picker also like radial time picker,recurrence picker 
compile 'com.code-troopers.betterpickers:library:3.1.0' 
compile 'com.mikepenz:actionitembadge:[email protected]' 
compile 'com.mobsandgeeks:android-saripaar:2.0.1' 
compile 'com.nightonke:boommenu:2.0.9' 





compile 'com.google.android.gms:play-services-location:9.2.0' 
compile 'com.google.android.gms:play-services-maps:9.2.0' 
compile 'com.google.android.gms:play-services-places:9.2.0' 

compile 'com.android.support:appcompat-v7:25.0.0' 
compile 'com.android.support:cardview-v7:25.0.0' 



//circular progress bar 
compile 'com.victor:lib:1.0.4' 

//app crash report 
compile 'ch.acra:acra:4.9.0' 

ext.googlePlayServicesVersion='10.0.1' 
ext.supportLibraryVersion='23.1.1' 

provided 'org.glassfish:javax.annotation:10.0-b28' 

apply plugin: 'com.google.gms.google-services' 
} 

错误:执行失败的任务 ':应用程序:transformClassesWithJarMergingForDebug'。

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/commons/collections/ArrayStack.class

+0

您可能正在使用Android Studio吗?你不能按Ctrl-N搜索ArrayStack类,搜索结果会显示包含它的所有库。 –

+0

我如何删除重复的类文件? –

+0

删除其中一个重复的库。或者更复杂的解决方案是排除依赖关系的依赖关系,因此您只能删除冲突的部分而不是整体。 –

回答

1
compile 'commons-validator:commons-validator:1.4.1' 

公地验证依赖性包含ArrayStack的两个版本,因为传递依赖其对公地集合。

通过排除声明中的commons-collections,可以有效地移除与该库关联的所有类,并且在运行时只剩下一个ArrayStack类。

compile('commons-validator:commons-validator:1.4.1') { 
    exclude module: 'commons-collections' 
} 
+0

此方法解决了我的问题。你救了我的同伴。 –

+0

好听。通过接受答案,您将问题标记为已解决,因此未来的其他人不需要尝试并回答问题。 –

相关问题