Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova FCM - Build Error: Failed to apply plugin [id 'com.google.gms.google-services']

I have a Cordova app with Android and iOS, and I am trying to add FCM so I can send push notification. I have followed the setup instructions on the site multiple times and continue to get the same build error.

Here is the error I get when I run Cordova build

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\Me\workspace\App\platforms\android\build.gradle' line: 326

* What went wrong:
A problem occurred evaluating root project 'android'.
> Failed to apply plugin [id 'com.google.gms.google-services']
   > For input string: "+"

This is what is on the last line of the build.gradle file apply plugin: 'com.google.gms.google-services', which is what the setup instruction says to do.

I have made an account, got my package name from AndroidManifest.xml, then added the google-services.json to the main in the Android project, and then added the 3 lines in the build.gradle file, but I continue to get this error.

What am I doing wrong? Thanks for the help.

like image 379
iqueqiorio Avatar asked Mar 12 '23 06:03

iqueqiorio


1 Answers

I had similar issues.

My fix was to edit ./platforms/android/project.properties

I changed the + to 10.0.1 on all the google services. (make sure the SDK is up-to-date)

ie:

cordova.system.library.1=com.google.android.gms:play-services-analytics:+

to

cordova.system.library.1=com.google.android.gms:play-services-analytics:10.0.1

Do a build and all worked.

like image 152
CapeCoder Avatar answered Apr 27 '23 04:04

CapeCoder