本文介绍了错误:执行任务':app:processDebugGoogleServices'失败。将com.google.android.gms的版本更新到10.2.6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何解决这个错误?



这是我的Gradle文件:

  apply plugin:'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion25.0.2
defaultConfig {
applicationIdcom.sjf.lgcats
minSdkVersion 15
targetSdkVersion 25
versionCode 2
versionName1.0.1
testInstrumentationRunnerandroid.support.test.runner.AndroidJUnitRunner
vectorDrawables.useSupportLibrary = tru e

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
sourceSets {main {assets.srcDirs = ['src / main / assets','src / main / assets / 2']}}
}

依赖{
编译fileTree(包括:['* .jar'],dir:'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2 .2',{
exclude group:'com.android.support',module:'support-annotations'
})

compile'c​​om.android.support:appcompat -v7:25.3.1'
compile'c​​om.android.support.constraint:constraint-layout:1.0.2'
compile'c​​om.android.support:design:25.3.1'
compile'c​​om.android.support:support-vector-drawable:25.3.1'
compile'c​​om.android.support:support-v4:25.3.1'
compile'c​​om.google.firebase :F irebase-auth:10.2.6'
compile'c​​om.google.firebase:firebase-messaging:10.2.6'
compile'c​​om.google.firebase:firebase-auth:11.0.0'
编译'com.google.android.gms:play-services-auth:11.0.0'
编译'commons-io:commons-io:2.0.1'
testCompile'junit:junit: 4.12'
}

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


解决方案

对所有Firebase和Google Play库使用相同的版本:

  compile'c​​om.google.firebase:firebase-auth:11.0.0'
compile'c​​om.google.firebase:firebase-messaging:11.0.0'
compile'c​​om.google。 android.gms:play-services-auth:11.0.0'

当您进行更改时,您可以也可以使用最新版本的构建工具:

$ $ $ $ $ $ $ $ $ buildToolsVersion $ 26.0 $
code $>

您可以简化版本号的维护并保证e他们总是这样做:

$ $ p $ $ $ $ $ $ $ $ $ SUPPORT_LIB_VER = '25.3.1'
GOOGLE_LIB_VER = '11.0.0'
}

依赖关系{
编译fileTree(包括:''.jar'],dir:'libs')
androidTestCompile ('com.android.support.test.espresso:espresso-core:2.2.2',{
exclude group:'com.android.support',module:'support-annotations'
})

compilecom.android.support:appcompat-v7:$SUPPORT_LIB_VER
compile'c​​om.android.support.constraint:constraint-layout:1.0.2'
compile com.android.support:design:$SUPPORT_LIB_VER
compilecom.android.support:support-vector-drawable:$SUPPORT_LIB_VER
compilecom.android.support:support-v4:$ SUPPORT_LIB_VER
compilecom.google.firebase:firebase-auth:$ GOOGLE_LIB_VER
compilecom.google.firebase:firebase-messaging:$ GOOGLE_LIB_VER
compilecom.google。 android.gms:播放 - 服务验证:$ GOOGLE_LIB_VER
编译commons-io:commons-io:2.0.1
testCompile'junit:junit:4.12'
}


I'm trying to implement Google Sign-In through Firebase into my Android app and the following message keeps appearing after my Gradle sync:

How can I fix this error?

Here's my Gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.sjf.lgcats"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 2
        versionName "1.0.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/2'] } }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:support-vector-drawable:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.google.firebase:firebase-auth:10.2.6'
    compile 'com.google.firebase:firebase-messaging:10.2.6'
    compile 'com.google.firebase:firebase-auth:11.0.0'
    compile 'com.google.android.gms:play-services-auth:11.0.0'
    compile 'commons-io:commons-io:2.0.1'
    testCompile 'junit:junit:4.12'
}

apply plugin: 'com.google.gms.google-services'
解决方案

Use the same version for all Firebase and Google Play libraries:

compile 'com.google.firebase:firebase-auth:11.0.0'
compile 'com.google.firebase:firebase-messaging:11.0.0'
compile 'com.google.android.gms:play-services-auth:11.0.0'

While your making changes, you could also use the latest version of build tools:

buildToolsVersion "26.0.0"

You can simplify maintenance of version numbers and ensure they are always consistent by doing this:

ext {
    SUPPORT_LIB_VER = '25.3.1'
    GOOGLE_LIB_VER = '11.0.0'
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile "com.android.support:appcompat-v7:$SUPPORT_LIB_VER"
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile "com.android.support:design:$SUPPORT_LIB_VER"
    compile "com.android.support:support-vector-drawable:$SUPPORT_LIB_VER"
    compile "com.android.support:support-v4:$SUPPORT_LIB_VER"
    compile "com.google.firebase:firebase-auth:$GOOGLE_LIB_VER"
    compile "com.google.firebase:firebase-messaging:$GOOGLE_LIB_VER"
    compile "com.google.android.gms:play-services-auth:$GOOGLE_LIB_VER"
    compile 'commons-io:commons-io:2.0.1'
    testCompile 'junit:junit:4.12'
}

这篇关于错误:执行任务':app:processDebugGoogleServices'失败。将com.google.android.gms的版本更新到10.2.6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 00:06