Si8 Si8 - 1 month ago 72
Android Question

Why is connecting to Firebase giving my application an issue from Android Studio

build.gradle (app):

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:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.google.firebase:firebase-core:9.8.0'

testCompile 'junit:junit:4.12'
}

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


build.grade (Project):

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


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


Google services and Google repositories are all up to date as per the SDK.

I am getting the following error:

Error:(42, 1) A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.google.gms.google-services']
> Version: 7.5.0 is lower than the minimum version (9.0.0) required for google-services plugin.


I am trying to connect to Firebase from my app and I have the
google-services.json
file inside the
app
folder.

How can I resolve the issue to connect to Firebase.

Answer

change

compile 'com.google.android.gms:play-services:7.5.0'

to

compile 'com.google.android.gms:play-services:9.8.0'

In conclusion:

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:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.google.firebase:firebase-core:9.8.0'

testCompile 'junit:junit:4.12'
}