Where do i add the com.google.gms:google-services plugin in my android project?

Viewed 730

I was just going through how to add firebase to your kotlin project and came across this document HERE (firebase documentation).

The file in the documentaton looks like the below :

buildscript {

  repositories {
    // Check that you have the following line (if not, add it):
    google()  // Google's Maven repository
  }

  dependencies {
    // ...

    // Add the following line:
    classpath 'com.google.gms:google-services:4.3.10'  // Google Services plugin
  }
}

allprojects {
  // ...

  repositories {
    // Check that you have the following line (if not, add it):
    google()  // Google's Maven repository
    // ...
  }
}

Basically the following line needs to be added inside dependencies :-

classpath 'com.google.gms:google-services:4.3.10'  // Google Services plugin

The problem is my build.gradle does't look anything like the above and infact looks like the below :-

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.1.2' apply false
    id 'com.android.library' version '7.1.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.5.30' apply false
}

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

So where and how exactly do i add this file in my android project ?

1 Answers

It is new format you can add in your plugins like this

id 'com.google.gms.google-services' version '4.3.10' apply false
Related