Adobe Creative SDK (Android) - Duplicate entry: com/google/android/gms/iid/zzc.class

寵の児 提交于 2019-12-24 10:43:17

问题


When I use Adobe Creative SDK, I'm facing the following error while building the APK.

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

When I switch my minSdkVersion to 21, it creates the APK successfully. I need this app to run on atleast Version 19.

My build.gradle file is:

apply plugin: 'com.android.application'
apply plugin: 'realm-android'
/* 1) Apply the Gradle Retrolambda Plugin */
apply plugin: 'me.tatarka.retrolambda'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'
    defaultConfig {
        applicationId 'com.example.myapp'
        minSdkVersion 20
        targetSdkVersion 25
        versionCode 10
        versionName "2.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        manifestPlaceholders = [appPackageName: "${applicationId}"]
        multiDexEnabled true
        dexOptions {
            jumboMode true
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    splits {
        // Split apks on build target ABI, view all options for the splits here:
        // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
        abi {
            enable true
            reset()
            include 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'mips', 'x86', 'x86_64'
        }
    }

    /* 2) Compile for Java 1.8 or greater */
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    /* 3) Exclude duplicate licenses */
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/DEPENDENCIES'
        pickFirst 'AndroidManifest.xml'
    }
    android {
        lintOptions {
            disable 'MissingTranslation'
        }
    }
    productFlavors {
    }
}
ext.versionCodes = ['armeabi': 10, 'armeabi-v7a': 11, 'arm64-v8a': 12, mips: 13, 'x86': 14, 'x86_64': 15]
import com.android.build.OutputFile

android.applicationVariants.all { variant ->
    // assign different version code for each output
    variant.outputs.each { output ->
        output.versionCodeOverride =
                project.ext.versionCodes.get(output.getFilter(OutputFile.ABI)) * 1000 + android.defaultConfig.versionCode
    }
}

repositories {
    jcenter()
    maven { url "http://kodbiro.github.io/repo/" }
    maven { url "https://jitpack.io" }
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile project(':kbimageview')
    compile project(':PGSDK_V2.0')
    compile project(':cropper')
    compile project(':matisse')
    /* 4) Add the CSDK framework dependencies (Make sure these version numbers are correct) */

    /* Add the CSDK framework dependencies (Make sure these version numbers are correct) */
    compile 'com.adobe.creativesdk.foundation:auth:0.9.1251'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'gun0912.ted:tedpermission:1.0.3'
    compile 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
    compile 'com.loopj.android:android-async-http:1.4.9'
    compile 'com.kaopiz:kprogresshud:1.1.0'
    compile 'com.github.ViksaaSkool:AwesomeSplash:v1.0.0'
    compile 'com.valdesekamdem.library:md-toast:0.9.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.google.firebase:firebase-core:11.0.2'
    compile 'com.google.firebase:firebase-auth:11.0.2'
    compile 'com.google.firebase:firebase-messaging:11.0.2'
    compile 'com.google.firebase:firebase-crash:11.0.2'
    compile 'com.firebase:firebase-jobdispatcher:0.7.0'
    compile 'me.everything:overscroll-decor-android:1.0.4'
    compile 'com.synnapps:carouselview:0.1.4'
    compile 'com.makeramen:roundedimageview:2.3.0'
    compile 'com.github.florent37:viewanimator:1.0.5'
    compile 'com.github.wooplr:Spotlight:1.2.3'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
    compile 'com.adobe.creativesdk:image:4.8.4'
    compile 'com.localytics.android:library:3.8.0'
    testCompile 'junit:junit:4.12'
}
configurations.all {
    resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
}
//https://stackoverflow.com/questions/45346959/duplicate-entry-com-google-android-gms-iid-zzc-class
apply plugin: 'com.google.gms.google-services'

The output of gradlew app:dependencies is (Could not paste it here since output was very big): https://1drv.ms/t/s!AhQ7CrkhMU-0hs5kp4b2xPm5rUvoVw


回答1:


I solved this issue by excluding com.google.android.gms from creativesdk, use below code:

compile ('com.adobe.creativesdk:image:4.8.4') {
    exclude group: 'com.google.android.gms'
}


来源:https://stackoverflow.com/questions/45984406/adobe-creative-sdk-android-duplicate-entry-com-google-android-gms-iid-zzc-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!