Could not find method classpath() for arguments [c

2019-04-19 08:37发布

问题:

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

回答1:

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'