JosCarrillo
JosCarrillo

Reputation: 85

fix the version conflict either by updating the version of the google-services or updating the version of com.google.android.gms

I'm just trying to use the Firebase Cloud Messaging but i'm getting a error. This is my first time doing this, so i think could be a version of the location services of something. I already put a few libraries, but i'm not sure whats is the problem. The Firebase is which is making some problems.

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

This is my Gradle (App).

apply plugin: 'com.android.application'
android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "com.xxx.xxx.xxx"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
        }
    }
    sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}

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'
    })

    allprojects {
        repositories {
            // Add this line
            maven { url "https://jitpack.io" }
        }
    }
    compile('com.wdullaer:materialdatetimepicker:3.2.2') {
        exclude group: 'com.android.support'
    }
    compile 'com.google.firebase:firebase-core:10.2.6'
    compile 'com.github.Mariovc:ImagePicker:1.2.0'
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:26.+'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    compile 'com.google.android.gms:play-services-location:11.0.4'
    compile 'com.android.support:support-v4:26.0.0-alpha1'
    compile 'com.google.android.gms:play-services-maps:11.0.4'
    compile 'com.android.support:cardview-v7:26.0.+'
    compile 'com.android.support:recyclerview-v7:26.0.+'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

And this is the other Gradle.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.google.gms:google-services:3.1.0'

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

allprojects {
    repositories {
        jcenter()
    }
}

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

Please help me, i'm in a rush

Upvotes: 0

Views: 4600

Answers (3)

Sameer Khan
Sameer Khan

Reputation: 637

This error also occurs if one does not add apply plugin: 'com.google.gms.google-services' to the bottom of app/build.gradle. I happened to overlook it and added it below apply plugin: 'com.android.application'.

Upvotes: 0

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363825

You are using different version of the same library using:

compile 'com.google.firebase:firebase-core:10.2.6'
compile 'com.google.android.gms:play-services-location:11.0.4'

You can use:

compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'

or you can switch to the latest stable version:

compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.android.gms:play-services-location:11.2.0'

This release requires to add the google maven repo.

    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
    }

More info about the releases of google play services here and firebase here.

Also you should use the stable version of:

compile 'com.android.support:support-v4:26.0.0'

Upvotes: 2

Yunus Kulyyev
Yunus Kulyyev

Reputation: 1022

Try to change the firebase version to the following:

    compile 'com.google.android.gms:play-services:11.0.2'
    compile 'com.google.firebase:firebase-core:11.0.2'

And add play-services

Upvotes: 0

Related Questions