Required: Latest versions of Android Studio and Google Play Services
You can add the plugin to your project by updating your top-level build.gradle and your app-level build.gradle files as follows:
classpath 'com.google.gms:google-services:3.0.0'
Like
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
}
}
Now, you need to add a dependency for Google Play Services. Inside your app's build.gradle add:
compile 'com.google.android.gms:play-services:9.6.1'
Finally
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "// set Yours"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'LICENSE.txt'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services-gcm:9.6.1'
compile 'com.android.support:appcompat-v7:24.2.0'
}
apply plugin: 'com.google.gms.google-services'