error when apply plugin: 'com.google.gms.google-services'

At first you should call

    dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'
    classpath 'com.google.gms:google-services:2.0.0-alpha2'
}

Don't (Avoid calling +)

compile 'com.google.android.gms:play-services-gcm:+'
     compile 'com.google.android.gms:play-services:8.4.0'

Do

     compile 'com.google.android.gms:play-services:8.4.0'

Need to enter the following entry in both gradle:

  1. Add the following to the @project level gradle file:

    classpath 'com.android.tools.build:gradle:1.3.0'
        classpath 'com.google.gms:google-services:3.0.0'
    
  2. Add the following to the @app level gradle file:

    // Dependency for Google Sign-In
    compile 'com.google.android.gms:play-services-auth:9.4.0'
    
  3. Add plugin:

    apply plugin: 'com.google.gms.google-services'