编辑:
我更改了这一行:
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: duplicate entry: 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
这是我的成绩
// 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'
你为什么要用这个?