gpt4 book ai didi

Android gradle google-services 构建失败 "Duplicate Entry"

转载 作者:行者123 更新时间:2023-11-29 01:24:15 26 4
gpt4 key购买 nike

编辑:

我改变了这一行:

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'.

Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 8.3.0.

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

原始问题

无中生有,我的应用无法成功构建。我尝试更新 google-services,但仍然收到错误消息。

What went wrong: Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.transform.api.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/ads/identifier/AdvertisingIdClient$Info.class

我的 gradle 也出现错误,在以下行:

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

应用程序等级:

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'

最佳答案

规则是所有 google play 服务都应该使用相同的版本虽然我只能看到使用 8.1.0 的一行,但您可能有另一个使用 8.4.0 的库,只需将您的库编辑为 8.4.0 而不是 8.1.0

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

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

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

你为什么要用这个?

关于Android gradle google-services 构建失败 "Duplicate Entry",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34982152/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com