28

I am getting this error while adding "com.google.gms:google-services:3.0.0" this script in my build.gradle dependency.

1

2 Answers 2

46

Apply this in build.gradle(Project: your project name) where tools.build:gradle is present and not in build.gradle(Module: app)

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'

        classpath 'com.google.gms:google-services:3.0.0'
    }
}

In build.gradle(Module: app) outside dependencies add this:

apply plugin: 'com.google.gms.google-services'
1
  • I tried to add this dependency to connect to google analytics and added this to build.gradle(module) but showing the same error May 17, 2022 at 21:23
2

If you are facing problem of connecting firebase to android studio then goto Tools -> Firebase -> Select any option like authenticate using google-sign in -> then click add the firebase authenticate -> Dependencies will be added automatically. This helped me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.