Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Asks to "Update google-services plugin or updating com.google.android.gms" for Firebase Auth and database

I am integrating Firebase Database and Authentication to my Android Project. I get the following error:

Error:org.gradle.api.GradleException: 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 9.4.0.

My app build.gradle file is below:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion '25.0.0'

    defaultConfig {
        applicationId "com.antoinecampbell.firebase.demo"
        minSdkVersion 19
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:24.1.1'
    compile 'com.android.support:design:24.1.1'
    compile 'com.android.support:cardview-v7:24.1.1'
    compile 'com.google.firebase:firebase-database:9.4.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-auth:10.2.1'
    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.google.android.gms:play-services-auth:9.2.1'

    testCompile 'junit:junit:4.12'
}



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

I know that I am mixing old and new version of dependencies, but can't figure out how to solve it. I will try to make this question as helpful as I can by editing it later.

like image 472
Aastha Dahal Avatar asked Apr 16 '17 22:04

Aastha Dahal


1 Answers

You need to add a dependency to Google-services to your root build.gradle. This file is different from your app/build.gradle one. Follow the Official Documentation to see exactly how your build.gradle and app/build.gradle file should look like.

Also Firebase and Play-services need to be on the same version number. So change the dependencies to have at least the same version number.

like image 57
mikehc Avatar answered Oct 11 '22 11:10

mikehc