androidgradledependenciesclasspathchipmunk

Latest Android Studio - Problem adding Google Service Gradle plugin to build.gradle file


I am having trouble adding Google Service Gradle plugin to build.gradle file in latest Android Studio Chipmunk. Specifically I am trying to add classpath 'com.google.gms:google-services:4.3.12'. It seems project level build.gradle file has changed from previous versions. I don't know where to add the above dependency. Any help would be highly appreciated. Thanks.


Solution

  • paste code for your build-script class file in project-level gradle.build file, here is an example :

        /**
         * project-level - build.gradle file -- make sure buildscript is before 
         * plugins
        **/
        buildscript {
            repositories {
                mavenCentral()
            }
            dependencies {
    // your classpath
                classpath 'com.google.dagger:hilt-android-gradle-plugin:2.41'
            }
        }
        
        // Top-level build file where you can add configuration options common to all sub-projects/modules.
        plugins {
            id 'com.android.application' version '7.1.3' apply false
            id 'com.android.library' version '7.1.3' apply false
            id 'org.jetbrains.kotlin.android' version '1.6.20' apply false
        }
        
        
        task clean(type: Delete) {
            delete rootProject.buildDir
        }