[Firebase Cloud Message Plugin] Android build fails with Firebase Cloud Messaging (FCM) and Google Analytics

[Firebase Cloud Message Plugin] Android build fails with Firebase Cloud Messaging (FCM) and Google Analytics

  
Forge Component
(3)
Published on 2017-10-30 by OutSystems Experts
3 votes
Published on 2017-10-30 by OutSystems Experts

There is a known issue when trying to use Firebase Cloud Messaging and Google Analytics on the same Android build.

After checking the build service log you will notice the following error message:

A problem occurred evaluating root project 'android'.
> Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
  > For input string: "+"

For more details: https://github.com/phonegap/phonegap-plugin-push/issues/1718

To work around the issue I created a fork of the Google Analytics main branch (OutSystemsExperts/google-analytics-plugin) which is referenced by the Google Analytics plugin on GitHub. The solution was to hardcode the version of Play Services to match the version of Play Services that is used by the FCM plugin. 

In the plugin.xml, the following chanegs were made:

-    <framework src="com.google.android.gms:play-services-analytics:+" />
 +    <framework src="com.google.android.gms:play-services-analytics:11.0.0" />

I then cloned the Google Analytics plugin and updated the "Extensibility Configurations" to point to the new branch.

After that, the build was successful when including both FCM and Google Analytics.

For reference, here is the GitHub link.

https://github.com/somehost/google-analytics-plugin

Thanks
Ouen