Search code examples
javaandroidbuild.gradlemqttapplozic

Duplicate entry in build.gradle zznp.class


I am trying to implement Applozic chat in my existing android app. I am already using MQTT for server communication in other classes and its working fine. But after downloading the Applozic library through build.gradle I am getting an error while compiling the application. Applozic also seems to be using the same MQTT technology. The error says:

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zznp.class
:app:transformClassesWithJarMergingForDebug FAILED

The build.gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.xxxxx.xxxx.xxx"
        minSdkVersion 17
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        // Enabling multidex support.
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    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'
    }
}

/*allprojects {
    repositories {
        jcenter()
        maven {
            url "https://repo.eclipse.org/content/repositories/paho-releases/"
        }

        maven { url "https://jitpack.io" }
    }
}*/

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    //testCompile 'junit:junit:4.12'
    compile 'com.applozic.communication.uiwidget:mobicomkitui:4.62'
    compile 'com.android.support:support-v4:23.0.1'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.google.android.gms:play-services:7.8.0'
    compile 'com.wdullaer:materialdatetimepicker:2.3.0'
    compile 'com.android.volley:volley:1.0.+'
    compile 'com.vlonjatg.android:app-tour:1.0'
    compile 'com.mukesh:permissions:1.0.2'

    compile 'com.github.JakeWharton:ViewPagerIndicator:2.4.1'



    /*compile "org.eclipse.paho:org.eclipse.paho.client.mqttv3:${rootProject.ext.clientVersion}"
    compile(project(':org.eclipse.paho.android.service')) {
        transitive = true
    }*/
}

task publishAPK(type: Copy) {
    from file("${project.buildDir}/outputs/apk/" + rootProject.ext.sampleArchivesBaseName + "-debug.apk");
    into '/shared/technology/paho/Android/' + rootProject.ext.sampleVersion + '/debug/';
}


configurations.compile.exclude module: 'org.eclipse.paho.client.mqttv3'
task debug << {
    configurations.compile.each { println it}
}

I do not understand why the error shows up. Which library is causing the conflict? What do I need to modify in order to remove the issue?


Solution

  • The error is due to this compile 'com.google.android.gms:play-services:7.8.0' lib as it is shown in the

    error duplicate entry: com/google/android/gms/internal/zznp.class :app:transformClassesWithJarMergingForDebug FAILED

    try to remove this and sync the project .hope it work