build.gradle zznp.class中的重复条目

时间:2016-10-22 05:56:53

标签: java android build.gradle mqtt applozic

我正在尝试在我现有的Android应用中实现Applozic聊天。我已经在其他类中使用MQTT进行服务器通信,并且工作正常。但是在通过build.gradle下载Applozic库后,我在编译应用程序时遇到错误。 Applozic似乎也在使用相同的MQTT技术。错误说:

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

build.gradle文件:

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

我不明白错误出现的原因。哪个库导致冲突?我需要修改什么才能解决问题?

2 个答案:

答案 0 :(得分:1)

错误是由compile 'com.google.android.gms:play-services:7.8.0'造成的 lib,因为它显示在

  

错误重复输入:com / google / android / gms /internal/zznp.class       :app:transformClassesWithJarMergingForDebug FAILED

尝试删除它并同步项目.hope it work

答案 1 :(得分:0)

Applozic android sdk正在使用谷歌播放服务v9.0.2可以通过更改为v9.0.2进行检查

  compile 'com.google.android.gms:play-services:9.0.2'

如果超过65k,请检查此链接 How to enable multidexing with the new Android Multidex support library