Project level build.gradle not containing the appropriate code

Viewed 61

I am trying to setup firebase for the first time and following a tutorial. I have to add this: classpath 'com.google.gms:google-services:4.3.12' to the project level build.gradle file under builscript->repositories but when I try to access the build.gradle file this is all I see:-

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

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

Now, I am not sure if this is due to a new update and the format has changed, but I have peeked at project level build.gradle file of a different project before and this is not what I saw. (This is a complete new project nothing has been done to the file other than adding the google-services.json file)

Can anyone help me out here if I am missing anything?

1 Answers

It can be added via the plugins API:

plugins {
    ...
    id 'com.google.gms.google-services' version '4.3.12' apply false
}

Then apply on the module level:

plugins {
    ...
    id 'com.google.gms.google-services'
}
Related