无法更新我的Google Play服务

时间:2018-02-14 11:58:29

标签: android android-studio android-gradle google-play-services

我正在创建一个使用firebase身份验证的项目。我进行了登录活动但是当我运行它时,它表示在Google Play服务未更新之前应用程序将无法运行。

以下是我对我的应用所做的一些更改:gradle文件。

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

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

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.devanshisukhija.sicsrattendance"
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.android.support:mediarouter-v7:27.0.2'
    implementation 'com.android.support:cardview-v7:27.0.2'
    implementation 'com.android.support:design:27.0.2'
    implementation 'com.android.support:recyclerview-v7:27.0.2'
    implementation 'com.android.support:support-v4:27.0.2'
    implementation 'com.google.gms:google-services:3.2.0'
    //implementation 'com.google.android.gms:play-services-base:11.4.2'
    implementation 'com.google.android.gms:play-services:11.8.0'
    implementation 'com.google.firebase:firebase-core:11.8.0'
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.google.firebase:firebase-database:11.8.0'
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

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

但我仍然收到以下错误:

  

错误:任务':app:processDebugGoogleServices'执行失败。

     

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

2 个答案:

答案 0 :(得分:0)

删除build gradle中的行

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

" com.android.application"包已经有com.google.gms.google-services'封装

答案 1 :(得分:0)

删除此

  

应用插件:' com.google.gms.google-services'

因为您已经提供了

  

应用插件:" com.google.gms.google-services"

因此无需应用gms.google.services插件。 并添加

  

classpath' com.google.gms:google-services:3.0.0'

在项目级构建文件中。

希望这会对你有所帮助。