2
votes

While running GCM Sender Application I am Getting this type of Exception

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources] :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72301Library :app:preDebugAndroidTestBuild UP-TO-DATE :app:prepareComAndroidSupportMultidex101Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42301Library :app:prepareComGoogleAndroidGmsPlayServicesBase830Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesBasement830Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesGcm830Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesMeasurement830Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl :app:compileDebugRenderscript :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:processDebugGoogleServices FAILED Error:Execution failed for task ':app:processDebugGoogleServices'.

File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it. Information:BUILD FAILED Information:Total time: 2.942 secs Information:1 error Information:0 warnings Information:See complete output in console

Can any One Please Clarify

4
I am download the code from git hub and Same code try to run in Android studio I am Getting above exception. I have searched all the possible solutions from link stackoverflow.com/questions/33342306/… and stackoverflow.com/questions/33556780/… but same exception will come can any one resolve my issue.. - IamDMahesh

4 Answers

0
votes

The way how to integrate Google Play Services has recently changed. You have to add a google-services.json.

Here you will find information how to get this config file and how to integrate GCM:

https://developers.google.com/cloud-messaging/android/client

0
votes

This sample uses the Google Services Plugin, which requires that you have the google-services.json file in the app directory of your project.

See this documentation, being sure to get the configuration file and add it to the app directory of your Android project.

Also be sure to update the API key value in GcmSender.java.

0
votes

Please add multiDexEnabled true in your project app gradle file and checkout,

defaultConfig {
    multiDexEnabled true
}
0
votes

You need To:

1-Go to https://console.firebase.google.com
2-Create a project.
3-Then go and click on Add Firebase to your Android app
4- Add (Package name, Debug signing certificate SHA-1)
5- Then Firebase will generate google-services.json
6- Copy this file and add it to your project root
7- Then follow every steps