【问题标题】:ZipException: transform duplicate entry com/google/android/gms/internal/zzez.classZipException:转换重复条目 com/google/android/gms/internal/zzez.class
【发布时间】:2018-06-28 11:48:24
【问题描述】:

当我尝试构建 APK 时,出现以下消息:

错误:任务执行失败 ':app:transformClassesWithJarMergingForDebug'.

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目: com/google/android/gms/internal/zzez.class

但是当我尝试调试这个应用程序时。

我已删除 .gradle 目录但没有成功。

这是我的 build.gradle 应用文件:

buildscript {
    repositories {
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'me.tatarka:gradle-retrolambda:3.2.2'
        classpath 'io.fabric.tools:gradle:1.21.4'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'

android {
    compileSdkVersion 24
    buildToolsVersion '26.0.2'

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/services/com.fasterxml.jackson.core.JsonFactory'
        exclude 'META-INF/NOTICE'
    }

    aaptOptions {
        useNewCruncher false
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.DringMe.launcher.fr"
        minSdkVersion 19
        targetSdkVersion 23
        multiDexEnabled true
    }

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

    repositories {
        maven {
            url 'http://repo.appspanel.com/appspanel-sdk-android/'
        }
        maven {
            url 'https://jitpack.io'
        }
    }

    dexOptions {
        incremental true
        javaMaxHeapSize "3g"
    }
    dependencies {
        compile 'com.squareup.retrofit:retrofit:1.9.0'
        compile 'com.squareup.retrofit:converter-simplexml:1.9.0'

        compile 'com.jakewharton:butterknife:7.0.1'
       // annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'


        //noinspection GradleCompatible
        compile 'com.android.support:design:24.2.1'
        //noinspection GradleCompatible
        compile 'com.google.android.gms:play-services-location:11.6.0'
        compile 'com.google.android.gms:play-services-maps:11.6.0'
        compile 'io.reactivex:rxandroid:1.0.1'
        compile 'de.greenrobot:eventbus:2.4.0'
        compile 'com.github.bumptech.glide:glide:3.7.0'
        compile 'com.pkmmte.view:circularimageview:1.1'
        compile 'com.nineoldandroids:library:2.4.0'
        compile 'com.github.sd6352051.niftydialogeffects:niftydialogeffects:1.0.0@aar'
        compile 'com.hannesdorfmann.smoothprogressbar:library:1.0.0'
        compile 'com.github.castorflex.smoothprogressbar:library-circular:1.0.0'

        compile files('src/main/libs/edm.jar')
        compile files('src/main/libs/rc.jar')
        compile files('src/main/libs/cdm.jar')
        compile files('src/main/libs/license.jar')
        compile files('src/main/libs/knox.jar')


        compile 'com.github.arimorty:floatingsearchview:2.0.3'
        //noinspection GradleDependency
        compile 'com.google.maps.android:android-maps-utils:0.4+'
        //noinspection GradleDependency
        compile 'com.akexorcist:googledirectionlibrary:1.0.4'
        compile project(':slideDateTimePicker-release')
        compile 'me.biubiubiu.justifytext:library:1.1'
        //noinspection GradleDependency
        compile 'com.android.support:multidex:1.0.1'


        compile project(':AppsPanelSDK')
      //  compile 'com.appspanel.android:sdk:4.4.2'
    }
}

configurations {
    compile.exclude group: 'stax'
    compile.exclude group: 'xpp3'
}

dependencies {
    compile project(':SmartAdServer-Android-SDK-6.7.1')
    //    compile project(':AppsPanelSDK')

}

我不知道为什么会这样,我被卡住了。

我需要帮忙!!

谢谢。

【问题讨论】:

  • 只是一个旁注,您的一些依赖项使用非常旧的版本,例如支持库、改造等
  • 将所有库升级到最新版本,并将编译替换为实现
  • 我尝试升级所有库并替换 compile by implementationataion 因为它不起作用。

标签: java android gradle build.gradle transform


【解决方案1】:

最后,我或多或少地解决了我的问题:

我替换

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

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

【讨论】:

    【解决方案2】:
    ext.googleServicesVersion = '11.8.0'
    implementation "com.google.android.gms:play-services-location:$googleServicesVersion"
    

    【讨论】:

    • 您能否添加一点解释,说明为什么这应该解决问题中所述的问题?
    猜你喜欢
    • 2017-12-28
    • 2018-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多