当我尝试生成应用程序时,会产生以下错误

时间:2017-08-31 09:56:03

标签: android android-studio android-gradle build.gradle

在尝试生成Android应用时,我收到了以下错误。所以请让我知道我的gradle文件或其他地方出了什么问题。

 Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
  

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

Build.gradle

apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
android {
    compileSdkVersion 26
    buildToolsVersion '26'

    defaultConfig {

        minSdkVersion 16
        targetSdkVersion 19

        multiDexEnabled true

        renderscriptTargetApi 19
        renderscriptSupportModeEnabled true

        manifestPlaceholders = [appPackageName: "${applicationId}"]
    }
    dexOptions {
        jumboMode true
    }


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

    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    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'
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.google.android.gms:play-services-ads:11.0.0'
    compile 'com.google.android.gms:play-services-basement:11.0.0' 
    compile 'com.google.android.gms:play-services-location:11.0.0' 

    compile 'com.adobe.creativesdk.foundation:auth:0.9.1251'
    compile 'com.adobe.creativesdk:image:4.8.4'
    compile 'com.localytics.android:library:3.8.0'

}

详细的堆栈跟踪如下

_releaseCompile - ##内部使用,不要手动配置##

+--- com.android.support:multidex:1.0.1
+--- com.larswerkman:HoloColorPicker:1.5
+--- com.android.support:appcompat-v7:25.2.0
|    +--- com.android.support:support-annotations:25.2.0
|    +--- com.android.support:support-v4:25.2.0
|    |    +--- com.android.support:support-compat:25.2.0
|    |    |    \--- com.android.support:support-annotations:25.2.0
|    |    +--- com.android.support:support-media-compat:25.2.0
|    |    |    +--- com.android.support:support-annotations:25.2.0
|    |    |    \--- com.android.support:support-compat:25.2.0 (*)
|    |    +--- com.android.support:support-core-utils:25.2.0
|    |    |    +--- com.android.support:support-annotations:25.2.0
|    |    |    \--- com.android.support:support-compat:25.2.0 (*)
|    |    +--- com.android.support:support-core-ui:25.2.0
|    |    |    +--- com.android.support:support-annotations:25.2.0
|    |    |    \--- com.android.support:support-compat:25.2.0 (*)
|    |    \--- com.android.support:support-fragment:25.2.0
|    |         +--- com.android.support:support-compat:25.2.0 (*)
|    |         +--- com.android.support:support-media-compat:25.2.0 (*)
|    |         +--- com.android.support:support-core-ui:25.2.0 (*)
|    |         \--- com.android.support:support-core-utils:25.2.0 (*)
|    +--- com.android.support:support-vector-drawable:25.2.0
|    |    +--- com.android.support:support-annotations:25.2.0
|    |    \--- com.android.support:support-compat:25.2.0 (*)
|    \--- com.android.support:animated-vector-drawable:25.2.0
|         \--- com.android.support:support-vector-drawable:25.2.0 (*)
+--- com.google.android.gms:play-services-ads:11.0.1
|    +--- com.google.android.gms:play-services-ads-lite:[11.0.1] -> 11.0.1
|    |    \--- com.google.android.gms:play-services-basement:[11.0.1] -> 11.0.1
|    |         \--- com.android.support:support-v4:25.2.0 (*)
|    +--- com.google.android.gms:play-services-base:[11.0.1] -> 11.0.1
|    |    +--- com.google.android.gms:play-services-basement:[11.0.1] -> 11.0.1 (*)
|    |    \--- com.google.android.gms:play-services-tasks:[11.0.1] -> 11.0.1
|    |         \--- com.google.android.gms:play-services-basement:[11.0.1] -> 11.0.1 (*)
|    +--- com.google.android.gms:play-services-clearcut:[11.0.1] -> 11.0.1
|    |    +--- com.google.android.gms:play-services-base:[11.0.1] -> 11.0.1 (*)
|    |    +--- com.google.android.gms:play-services-basement:[11.0.1] -> 11.0.1 (*)
|    |    \--- com.google.android.gms:play-services-tasks:[11.0.1] -> 11.0.1 (*)
|    +--- com.google.android.gms:play-services-basement:[11.0.1] -> 11.0.1 (*)
|    +--- com.google.android.gms:play-services-gass:[11.0.1] -> 11.0.1
|    |    \--- com.google.android.gms:play-services-basement:[11.0.1] -> 11.0.1 (*)
|    \--- com.google.android.gms:play-services-safetynet:[11.0.1] -> 11.0.1
|         +--- com.google.android.gms:play-services-base:[11.0.1] -> 11.0.1 (*)
|         +--- com.google.android.gms:play-services-basement:[11.0.1] -> 11.0.1 (*)
|         \--- com.google.android.gms:play-services-tasks:[11.0.1] -> 11.0.1 (*)
+--- com.startapp:inapp-sdk:3.6.3
+--- com.alexzh:circleimageview:1.1.2
+--- com.amitshekhar.android:android-networking:1.0.0
|    +--- com.squareup.okhttp3:okhttp:3.6.0
|    |    \--- com.squareup.okio:okio:1.11.0
|    \--- com.google.code.gson:gson:2.8.0
+--- cn.pedant.sweetalert:library:1.3
|    \--- com.pnikosis:materialish-progress:1.0
|         \--- com.android.support:appcompat-v7:21.0.0 -> 25.2.0 (*)
+--- com.appnext.sdk:native-ads:2.+ -> 2.0.6.462
|    \--- com.appnext.sdk:core:2.0.6.462
+--- com.google.android.gms:play-services-basement:11.0.1 (*)
+--- com.google.android.gms:play-services-location:11.0.1
|    +--- com.google.android.gms:play-services-base:[11.0.1] -> 11.0.1 (*)
|    +--- com.google.android.gms:play-services-basement:[11.0.1] -> 11.0.1 (*)
|    \--- com.google.android.gms:play-services-tasks:[11.0.1] -> 11.0.1 (*)
+--- com.edmodo:cropper:1.0.1
+--- com.adobe.creativesdk.foundation:auth:0.9.1251
|    +--- com.android.support:support-v4:25.0.1 -> 25.2.0 (*)
|    +--- com.android.support:appcompat-v7:25.0.1 -> 25.2.0 (*)
|    +--- commons-io:commons-io:2.4
|    +--- com.birbit:android-priority-jobqueue:2.0.0-beta2
|    |    +--- com.squareup.okio:okio:1.8.0 -> 1.11.0
|    |    \--- com.android.support:support-v4:21.0.3 -> 25.2.0 (*)
|    \--- com.readystatesoftware.systembartint:systembartint:1.0.3
+--- com.adobe.creativesdk:image:4.8.4
|    +--- com.jakewharton.hugo:hugo-annotations:1.2.1
|    +--- com.adobe.creativesdk.foundation:auth:0.9.1251 (*)
|    +--- com.sothree.slidinguppanel:library:3.3.1
|    |    +--- com.android.support:recyclerview-v7:23.4.0 -> 25.0.0
|    |    |    +--- com.android.support:support-annotations:25.0.0 -> 25.2.0
|    |    |    +--- com.android.support:support-compat:25.0.0 -> 25.2.0 (*)
|    |    |    \--- com.android.support:support-core-ui:25.0.0 -> 25.2.0 (*)
|    |    +--- com.android.support:support-v4:23.4.0 -> 25.2.0 (*)
|    |    \--- com.android.support:support-annotations:23.4.0 -> 25.2.0
|    +--- it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.15
|    |    \--- com.android.support:appcompat-v7:24.1.1 -> 25.2.0 (*)
|    +--- it.sephiroth.android.library.picasso:picasso:2.5.2.4b
|    |    +--- com.squareup.okhttp:okhttp-urlconnection:2.1.0
|    |    |    \--- com.squareup.okhttp:okhttp:2.1.0
|    |    |         \--- com.squareup.okio:okio:1.0.1 -> 1.11.0
|    |    +--- com.squareup.okhttp:okhttp:2.1.0 (*)
|    |    \--- com.intellij:annotations:12.0
|    +--- it.sephiroth.android.exif:android-exif-extended:1.0.6
|    |    +--- org.apache.commons:commons-lang3:3.3.2 -> 3.4
|    |    \--- commons-io:commons-io:2.4
|    +--- it.sephiroth.android.library.disklrumulticache:disklrumulticache:1.0.8
|    |    +--- commons-io:commons-io:2.4
|    |    \--- com.jakewharton:disklrucache:2.0.2
|    +--- it.sephiroth.android.library.viewrevealanimator:view-reveal-animator:1.1.4
|    |    \--- com.android.support:support-v4:21.0.3 -> 25.2.0 (*)
|    +--- com.timehop.stickyheadersrecyclerview:library:0.4.3
|    |    \--- com.android.support:recyclerview-v7:22.2.0 -> 25.0.0 (*)
|    +--- io.reactivex:rxandroid:1.2.1
|    |    \--- io.reactivex:rxjava:1.1.6 -> 1.2.2
|    +--- it.sephiroth:rxbroadcast:0.0.2
|    |    +--- com.android.support:appcompat-v7:23.0.0 -> 25.2.0 (*)
|    |    \--- io.reactivex:rxjava:1.0.14 -> 1.2.2
|    +--- com.trello:rxlifecycle-components:0.8.0
|    |    +--- com.trello:rxlifecycle-android:0.8.0
|    |    |    +--- com.trello:rxlifecycle:0.8.0
|    |    |    |    +--- io.reactivex:rxjava:1.2.0 -> 1.2.2
|    |    |    |    \--- com.google.code.findbugs:jsr305:3.0.1
|    |    |    \--- com.jakewharton.rxbinding:rxbinding:0.4.0
|    |    |         +--- io.reactivex:rxandroid:1.1.0 -> 1.2.1 (*)
|    |    |         +--- io.reactivex:rxjava:1.1.0 -> 1.2.2
|    |    |         \--- com.android.support:support-annotations:23.1.0 -> 25.2.0
|    |    +--- io.reactivex:rxjava:1.2.0 -> 1.2.2
|    |    \--- com.android.support:appcompat-v7:24.2.0 -> 25.2.0 (*)
|    +--- com.trello:rxlifecycle:0.8.0 (*)
|    +--- com.jakewharton.rxbinding:rxbinding:0.4.0 (*)
|    +--- com.jakewharton.rxbinding:rxbinding-appcompat-v7:0.4.0
|    |    +--- com.jakewharton.rxbinding:rxbinding:0.4.0 (*)
|    |    \--- com.android.support:appcompat-v7:23.1.0 -> 25.2.0 (*)
|    +--- com.jakewharton.rxbinding:rxbinding-support-v4:0.4.0
|    |    +--- com.android.support:support-v4:23.1.0 -> 25.2.0 (*)
|    |    \--- com.jakewharton.rxbinding:rxbinding:0.4.0 (*)
|    +--- io.reactivex:rxjava-async-util:0.21.0
|    |    \--- io.reactivex:rxjava:1.0.0-rc.3 -> 1.2.2
|    +--- com.getbase:floatingactionbutton:1.10.0
|    |    \--- com.android.support:support-annotations:22.2.0 -> 25.2.0
|    +--- com.adobe.creativesdk:image-native:1.3.344
|    |    +--- com.jakewharton.hugo:hugo-annotations:1.2.1
|    |    +--- com.adobe.creativesdk.android.shared:android-shared:0.0.9
|    |    |    +--- com.jakewharton.hugo:hugo-annotations:1.2.1
|    |    |    +--- com.android.support:support-v13:24.1.1
|    |    |    |    \--- com.android.support:support-v4:24.1.1 -> 25.2.0 (*)
|    |    |    +--- com.infstory:proguard-annotations:1.0.2
|    |    |    +--- com.android.support:support-annotations:24.1.1 -> 25.2.0
|    |    |    +--- commons-io:commons-io:2.4
|    |    |    +--- com.squareup.okhttp3:okhttp:3.4.1 -> 3.6.0 (*)
|    |    |    \--- io.reactivex:rxjava:1.2.0 -> 1.2.2
|    |    +--- com.android.support:appcompat-v7:24.1.1 -> 25.2.0 (*)
|    |    \--- com.infstory:proguard-annotations:1.0.2
|    +--- de.hdodenhof:circleimageview:2.0.0
|    +--- com.google.android.gms:play-services-gcm:9.4.0
|    |    +--- com.google.android.gms:play-services-base:9.4.0 -> 11.0.1 (*)
|    |    +--- com.google.android.gms:play-services-basement:9.4.0 -> 11.0.1 (*)
|    |    \--- com.google.android.gms:play-services-iid:9.4.0
|    |         +--- com.google.android.gms:play-services-base:9.4.0 -> 11.0.1 (*)
|    |         \--- com.google.android.gms:play-services-basement:9.4.0 -> 11.0.1 (*)
|    +--- com.adobe.creativesdk.android.shared.common:common-ui:1.1.8
|    |    +--- com.android.support:appcompat-v7:24.1.1 -> 25.2.0 (*)
|    |    \--- com.android.support:recyclerview-v7:24.1.1 -> 25.0.0 (*)
|    +--- com.android.support:palette-v7:25.0.0
|    |    +--- com.android.support:support-compat:25.0.0 -> 25.2.0 (*)
|    |    \--- com.android.support:support-core-utils:25.0.0 -> 25.2.0 (*)
|    +--- com.android.support:design:25.0.0
|    |    +--- com.android.support:support-v4:25.0.0 -> 25.2.0 (*)
|    |    +--- com.android.support:appcompat-v7:25.0.0 -> 25.2.0 (*)
|    |    +--- com.android.support:recyclerview-v7:25.0.0 (*)
|    |    \--- com.android.support:transition:25.0.0
|    |         \--- com.android.support:support-v4:25.0.0 -> 25.2.0 (*)
|    +--- com.android.support:recyclerview-v7:25.0.0 (*)
|    +--- com.android.support:cardview-v7:25.0.0
|    |    \--- com.android.support:support-annotations:25.0.0 -> 25.2.0
|    +--- com.android.support:appcompat-v7:25.0.0 -> 25.2.0 (*)
|    +--- com.google.android.gms:play-services-base:9.4.0 -> 11.0.1 (*)
|    +--- it.sephiroth.android.library.imagezoom:imagezoom:2.2.5
|    +--- it.sephiroth.android.library.ab:ab-test:2.0.5
|    +--- org.greenrobot:eventbus:3.0.0
|    +--- org.apache.commons:commons-lang3:3.4
|    +--- io.reactivex:rxjava:1.2.2
|    +--- com.squareup.okhttp3:okhttp:3.4.1 -> 3.6.0 (*)
|    +--- com.infstory:proguard-annotations:1.0.2
|    +--- com.squareup.okhttp3:okhttp-urlconnection:3.4.1
|    |    \--- com.squareup.okhttp3:okhttp:3.4.1 -> 3.6.0 (*)
|    \--- com.localytics.android:library:4.0.1
\--- com.localytics.android:library:3.8.0 -> 4.0.1

4 个答案:

答案 0 :(得分:0)

更改以下库版本:

compile 'com.google.android.gms:play-services-ads:11.0.2'
compile 'com.google.android.gms:play-services-basement:11.0.2' 
compile 'com.google.android.gms:play-services-location:11.0.2' 

如果没有效果,请尝试使用版本11.0.3和11.0.4

答案 1 :(得分:0)

在您的依赖项中,而不是

compile 'com.android.support:appcompat-v7:25.2.0'

尝试

compile 'com.android.support:appcompat-v7:26.+'

忽略警告说您不应该使用" +"作为版本。

答案 2 :(得分:0)

您应该在依赖项中强制com.google.android.gms:play-services-gcm:11.0.1

在您的依赖项输出中观看:com.adobe.creativesdk:image需要Google Play服务库版本9.4.0,它需要与版本9.4.0的内部依赖关系。但com.google.android.gms:play-services-ads:11.0.0需要内部依赖版本11.0.0。最简单的解决方案 - 强制新版本。

+--- com.adobe.creativesdk:image:4.8.4
|    +--- com.google.android.gms:play-services-gcm:9.4.0 // conflict here
|    |    +--- com.google.android.gms:play-services-base:9.4.0 -> 11.0.1 (*)
|    |    +--- com.google.android.gms:play-services-basement:9.4.0 -> 11.0.1 (*)
|    |    \--- com.google.android.gms:play-services-iid:9.4.0 // conflict here
|    |         +--- com.google.android.gms:play-services-base:9.4.0 -> 11.0.1 (*)
|    |         \--- com.google.android.gms:play-services-basement:9.4.0 -> 11.0.1 (*)

答案 3 :(得分:0)

我得到了解决方案,在build.gradle中我将库更改为10.2.0

  compile 'com.google.android.gms:play-services-ads-lite:10.2.0'
  compile 'com.google.android.gms:play-services-basement:10.2.0'
  compile 'com.google.android.gms:play-services-location:10.2.0' 

从主项目gradle我删除:

classpath 'com.google.gms:google-services:3.1.0'