0
votes

When I add the line: compile 'com.google.firebase:firebase-messaging:10.0.1' in the file build.gradle and click in sync now in the AndroidStudio:

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

I removed the line apply plugin: 'com.google.gms.google-services' then the error disappear. But the firebase-auth failure: Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process br.ufrn.imd.sgr. Make sure to call FirebaseApp.initializeApp(Context) first.

Help me, please.

build.gradle(Project)

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
}

build.gradle(Module app):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "package.exemplo"
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    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:design:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'

    compile 'com.google.firebase:firebase-messaging:10.0.1'
    compile 'com.google.firebase:firebase-auth:11.0.2'
    compile 'com.google.code.gson:gson:2.6.2'
    compile  project (':volley')
}


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

1 Answers

0
votes

Here the deal: you added too old dependency. Your Firebase Auth dependency version is 11.0.2:

compile 'com.google.firebase:firebase-auth:11.0.2'

And you added one more Firebase dependency with version 10.0.1:

compile 'com.google.firebase:firebase-messaging:10.0.1'

So there is dependencies version conflict. That's why you have Gradle build error when you are trying to sync.

To solve this just make your firebase-messaging dependency version to latest one and reapply Google Services Gradle plugin:

dependencies {
    ...

    compile 'com.google.firebase:firebase-auth:11.0.2'
    compile 'com.google.firebase:firebase-messaging:11.0.2'

    ...
}

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

Hope this helps.