Android gradle google-services构建失败"重复条目"

时间:2016-01-24 22:12:28

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

修改

我更改了这一行:

compile 'com.google.android.gms:play-services-analytics:8.1.0'

要:

compile 'com.google.android.gms:play-services-analytics:8.4.0'

我将类路径更改为:

classpath 'com.google.gms:google-services:2.0.0-alpha7'

并将gradle版本更新为2.10以修复我提到的其他问题。现在,每当我构建时,我都会遇到此错误:

Error:Execution failed for task ':app:processDebugGoogleServices'.
  

请修改版本冲突,方法是更新google-services插件的版本(https://bintray.com/android/android-tools/com.google.gms.google-services/提供有关最新版本的信息)或将com.google.android.gms版本更新为8.3.0

-------------------------------------------- -------------------------------------------------- ----------------------------

原始问题

无中生有,我的应用程序无法成功构建。我尝试更新谷歌服务,但我仍然收到错误。

  

出了什么问题:   任务':app:transformClassesWithJarMergingForDebug'执行失败。   com.android.build.transform.api.TransformException:java.util.zip.ZipException:重复条目:com / google / android / gms / ads / identifier / AdvertisingIdClient $ Info.class

我的格斗中也出现了错误:

    compile 'com.google.android.gms:play-services-analytics:8.1.0'

说某些谷歌库的版本是8.4.0版,有些是8.1.0版。我尝试将谷歌库升级到8.4.0。 gradle不会构建并给我以下错误:

Warning:Gradle version 2.10 is required. Current version is 2.8. If 
 using the gradle wrapper, try editing the distributionUrl in 
/Users/essam/Desktop/Apptuto/gradle/wrapper/gradle-wrapper.properties 
to gradle-2.10-all.zip

这是我的gradle

 // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.3.0'
    classpath 'com.google.gms:google-services:1.4.0-beta3'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    jcenter()
}
}

app gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: "findbugs"
apply plugin: "pmd"
android {
android {
    useLibrary 'org.apache.http.legacy'
}
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
    applicationId "my package name is written here"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.1"
    multiDexEnabled true
}

buildTypes {

    release {
        minifyEnabled false
        shrinkResources false
    }
    debug {
        debuggable true
    }
}


}
findbugs {
ignoreFailures = true
toolVersion = "2.0.1"
reportsDir = file("$project.buildDir/reports/findbugs")
effort = "max"
}

pmd {
ignoreFailures = true
reportsDir = file("$project.buildDir/reports/pmd")
ruleSets = [
        "basic",
        "braces"
]
}


dependencies {
compile('com.mikepenz:materialdrawer:4.3.7@aar') {
    transitive = true

}
repositories {
    mavenCentral()
    maven {
        url 'https://dl.bintray.com/intercom/intercom-maven'
    }
}

compile('io.intercom.android:intercom-sdk:1.+@aar') {
    transitive = true
}
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.pkmmte.view:circularimageview:1.1'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'org.apache.httpcomponents:httpmime:4.2.3'
compile 'com.mixpanel.android:mixpanel-android:4.6.4'
compile 'info.hoang8f:android-segmented:1.0.6'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:support-v4:23.1.1'

}

1 个答案:

答案 0 :(得分:1)

规则是所有Google Play服务应该使用相同的版本 虽然我只能看到一行使用8.1.0,你可能有另一个使用8.4.0的库,只需编辑你的8.4.0而不是8.1.0

现在对于另一个错误,我不知道,它没有发生在我身上我复制了你的确切gradle并且编译了

如果它一直出现,请尝试删除第二行:

apply plugin: 'com.google.gms.google-services'

你为什么用这种方式?