Resolving the “Execution failed for task ‘: app: processDebugGoogleServices'”

I was developing a small project ( app for Android) in Cordova ( https://cordova.apache.org ), and this project one of the requirements was to send notifications push ( push notifications ) to the application through the Service Cloud Messaging  Google Firebase ( https://console.firebase.google.com ).

The procedure for implementing this task is relatively simple. Just access the Google Firebase console, create a new project, enter the information (name, package, etc …), configure it for Android and finally download the file google-services.json

This file, in the case of a Cordova project, must be inserted into the folder “platforms/android/app.

In addition, it is necessary to import the “phonegap-plugin-push” library for the project.

That done, I tried to  build  the  app,  but I ended up with the following error:

Execution failed for task ':app:processDebugGoogleServices'

This error is followed by the following message:

File google-services.json is missing. The Google Services Plugin cannot function without it.

This error is caused due to the absence of a  dependency  in the Gradle configuration file (Gradle is a Build Tool responsible for “building” the app from the Cordova project).

To solve, just go to the folder “platforms/android/app” and open the file “build.gradle“.

In this file, it is necessary to locate the line “dependencies“. Within the {} of the “dependencies“, you must insert the following classpath

classpath 'com.google.gms: google-services: 3.0.0'

That way, your code will look something like this:

dependencies {
        apply from: '../CordovaLib/cordova.gradle'
 
        classpath 'com.android.tools.build:gradle:4.0.0'
        classpath 'com.google.gms: google-services: 3.0.0'
        . 
        . 
        .
}

After inserting the  classpath,  save the file and try to run again. It will work!!!

Any questions leave your comment

See you!

Holds a university degree in Information Systems, a postgraduate degree in Database Systems and a master's degree in Education with a focus on Sociocommunity Technologies. He works as a professor of technical and technological education at the Federal Institute of Education, Science and Technology of São Paulo, teaching subjects in the areas of programming, database, project development and software engineering.

Posts relacionados

Leave a Reply

Your email address will not be published. Required fields are marked *