Afams
Afams

Reputation: 47

Execution failed for task ':app:processDebugGoogleServices' Firebase&Android Studio

I want to add Firebase-database to the my Android application and I have got error.

FAILURE: Build failed with an exception.

build.gradle app

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.lukasz.ogloszenia"
        minSdkVersion 14
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
        }
    }
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:27.1.1'
        implementation 'com.android.support.constraint:constraint-layout:1.1.0'
        implementation 'com.android.support:support-v4:27.1.1'
        implementation 'com.google.firebase:firebase-database:11.8.0'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-                    core:3.0.2'

        implementation 'com.google.android.gms:play-services-maps:12.0.1'
        compile 'com.google.gms:google-services:4.0.1'

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

Can someone help me?

Upvotes: 1

Views: 12989

Answers (1)

Peter Haddad
Peter Haddad

Reputation: 80904

change this:

implementation 'com.google.firebase:firebase-database:11.8.0'

to this:

implementation 'com.google.firebase:firebase-database:12.0.1'

All google play services and firebase dependencies need to have the same version number.

This changes starting from version number 15:

Each Maven dependency matching com.google.android.gms:play-services-* and com.google.firebase:firebase-* is no longer required to have the same version number in order to work correctly at build time and at run time.

https://android-developers.googleblog.com/2018/05/announcing-new-sdk-versioning.html

Upvotes: 3

Related Questions