大家好我在排除某些组和模块后面临smack和quickblox库之间重复输入的错误我能够添加两个库但由于此错误而未能添加第三个库。
错误:任务':app:transformClassesWithJarMergingForDebug'执行失败。
com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:org / jivesoftware / smack / android / AndroidSmackInitializer.class
我已经尝试了很多方法通过打包选项和其他方法来解决这个问题,但是没有一个方法可以帮助我尝试解决这个问题。
我的build.gradle文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.messenger.Bolo"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
java {
exclude 'org/jivesoftware/smack/android/AndroidSmackInitializer.class'
exclude '**/AndroidSmackInitializer.class'
}
}
androidTest {
java {
exclude '**/AndroidSmackInitializer.class'
exclude 'org/jivesoftware/smack/android/AndroidSmackInitializer.class'
}
}
}
packagingOptions
{
exclude 'BuildConfig.class'
exclude 'ExtensionsInitializer.class'
exclude 'AbstractXMPPConnection$8.class'
exclude 'MiniDnsResolver.class'
exclude 'XMPPTCPConnection$PacketWriter.class'
exclude 'ExtensionsInitializer.class'
exclude 'AndroidSmackInitializer.class'
exclude 'XmppStringPrepUtil.class'
exclude 'org.jivesoftware.smack.android.AndroidSmackInitializer.class'
exclude 'org/jivesoftware/smack/android/AndroidSmackInitializer.class'
exclude '**/AndroidSmackInitializer.class'
}
configurations {
all*.exclude group: 'org.jivesoftware.smack.android.AndroidSmackInitializer.class'
}
//useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:design:23.1.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:support-v4:23.1.1'
compile 'org.igniterealtime.smack:smack-im:4.1.5'
compile 'org.igniterealtime.smack:smack-tcp:4.1.5'
compile 'org.igniterealtime.smack:smack-android-extensions:4.1.5'
compile 'org.igniterealtime.smack:smack-extensions:4.1.5'
compile 'org.igniterealtime.smack:smack-core:4.1.5'
compile 'org.igniterealtime.smack:smack-resolver-dnsjava:4.1.5'
compile("com.quickblox:quickblox-android-sdk-core:$rootProject.qbSdkVersion@aar") {
exclude module: 'org.igniterealtime.smack:smack-resolver-dnsjava:4.1.6'
exclude module: 'org.igniterealtime.smack:smack-im:4.1.6'
exclude module: 'org.igniterealtime.smack:smack-tcp:4.1.6'
exclude module: 'org.igniterealtime.smack:smack-android-extensions:4.1.6'
exclude module: 'org.igniterealtime.smack:smack-extensions:4.1.6'
exclude module: 'org.igniterealtime.smack:smack-core:4.1.6'
exclude group: "org/jivesoftware/smack/android/**"
exclude group: "org/jivesoftware/smack/android/AndroidSmackInitializer.class"
exclude group: "org/jivesoftware/smack/android/**"
exclude group: '**/AndroidSmackInitializer.class'
}
compile("com.quickblox:quickblox-android-sdk-chat:$rootProject.qbSdkVersion@aar") {
transitive = true
exclude module: 'org.igniterealtime.smack:smack-resolver-dnsjava:4.1.5'
exclude module: 'org.igniterealtime.smack:smack-im:4.1.5'
exclude module: 'org.igniterealtime.smack:smack-tcp:4.1.5'
exclude module: 'org.igniterealtime.smack:smack-android-extensions:4.1.5'
exclude module: 'org.igniterealtime.smack:smack-extensions:4.1.5'
exclude module: 'org.igniterealtime.smack:smack-core:4.1.5'
exclude group: '**/AndroidSmackInitializer.class'
//exclude module: 'org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.class'
exclude group: "org/jivesoftware/smack/android/AndroidSmackInitializer.class"
exclude group: "org/jivesoftware/smack/android/**"
}
compile("com.quickblox:quickblox-android-sdk-videochat-webrtc:$rootProject.qbSdkVersion@aar") {
//exclude module: 'support-v4'
exclude module: 'org.igniterealtime.smack:smack-resolver-dnsjava:4.1.5'
exclude module: 'org.igniterealtime.smack:smack-im:4.1.5'
exclude module: 'org.igniterealtime.smack:smack-tcp:4.1.5'
exclude module: 'org.igniterealtime.smack:smack-android-extensions:4.1.5'
exclude module: 'org.igniterealtime.smack:smack-extensions:4.1.5'
exclude module: 'org.igniterealtime.smack:smack-core:4.1.5'
exclude group: "org/jivesoftware/smack/android/**"
exclude group: "org/jivesoftware/smack/android/AndroidSmackInitializer.class"
exclude group: "org/jivesoftware/smack/android/**"
exclude group: '**/AndroidSmackInitializer.class'
}
compile files('libs/org.apache.http.legacy.jar')
}
task androidReleaseJar(type: Jar, dependsOn: assembleRelease) {
from "$buildDir/intermediates/classes/release/"
exclude 'org/jivesoftware/smack/android/AndroidSmackInitializer.class'
}