android studio失败了任务':app:processDebugGoogleServices'

时间:2017-11-28 16:01:37

标签: android google-maps-api-3

当我想要构建我的项目时,会弹出一个错误,它说:Exectuion因任务而失败'应用程序:processDebugGoogleServices'。

这是完整的错误:

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

这些是我的gradle文件。

    apply plugin: 'com.android.application'

android {
    signingConfigs {

    }
    dexOptions {
        javaMaxHeapSize "2g"
    }
    compileSdkVersion 25
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "org.x.x"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 2
        versionName "1.1"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    **implementation 'com.google.android.gms:play-services-maps:11.6.0'**
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.google.code.gson:gson:2.5'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.loopj.android:android-async-http:1.4.9'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.google.firebase:firebase-auth:11.0.4'
    compile 'com.google.firebase:firebase-messaging:11.0.4'
    compile 'com.google.firebase:firebase-core:11.0.4'
    compile 'com.google.firebase:firebase-analytics:11.0.4'
    compile 'com.google.android.gms:play-services-auth:11.6.0'
    compile 'com.android.support.constraint:constraint-layout:+'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.facebook.android:facebook-share:[4,5)'
    compile 'com.ToxicBakery.viewpager.transforms:view-pager-transforms:1.2.32@aar'
    compile 'org.apache.commons:commons-lang3:3.4'
    compile 'com.getbase:floatingactionbutton:1.9.0'
    compile 'com.ms-square:expandableTextView:0.1.4'
    compile 'com.android.support:multidex:1.0.1'
    testCompile 'junit:junit:4.12'
}

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

和另一个gradle文件

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath 'com.google.gms:google-services:3.1.1'

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

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

在第一个gradle中,实施' com.google.android.gms:play-services-maps:11.6.0' 会抛出错误消息:

All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 11.6.0, 11.0.4. Examples include com.google.android.gms:play-services-auth:11.6.0 and com.google.firebase:firebase-analytics:11.0.4

我做错了什么?

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。

您需要做的唯一事情就是写出相同的版本:

implementation 'com.google.android.gms:play-services-maps:***11.6.0**'*

来自Google和FIREBASE的其他图书馆