So this morning I started updating to the latest version of my project libraries.
I\'m trying to update GCM to the latest version 9.2.0, but I get this error:
<For Cordova OR Ionic Hybrid App
I have the very similar problem with my Ionic 1 Cordova Build after Integrating the Firebase Cloud Messaging ( FCM )
I fixed this issue by the following steps
So one fix will be: inside platforms/android open project.properties (Its a file ) , you will have something like this
cordova.system.library.1=com.google.android.gms:play-services-ads:+
cordova.system.library.2=com.google.firebase:firebase-core:+
cordova.system.library.3=com.google.firebase:firebase-messaging:+
Replace the
+
Sign with your target version number - like the following
cordova.system.library.1=com.google.android.gms:play-services-ads:9.0.0
cordova.system.library.2=com.google.firebase:firebase-core:9.0.0
cordova.system.library.3=com.google.firebase:firebase-messaging:9.0.0
Save the file
Then take build using
ionic cordova run android
I hope this will work for everyone
Add this line at the bottom of the gradle.
apply plugin: 'com.google.gms.google-services'
because it the top it does not work.I was facing similar problem.
Your target SDK
might be higher than SDK
of the device, change that.
For example, your device is running API 23 but your target SDK
is 25.
Change 25 to 23.
if you have Firebase included also, make them of same version as the error says.
The same situation was with the previous versions. It's annoing that new versions com.google.android.gms libraries are always releasing before plugin, and it's impossible to use new version because is incompatible with old plugin. I don't know if plugin is now required (google docs sucks). I remember times when it wasn't. The only way is wait for new plugin version, or you can try to remove plugin dependencies, but as I said I'am not sure if gcm will work without it. What I know the main feature of 9.2.0 version is new Awareness API https://inthecheesefactory.com/blog/google-awareness-api-in-action/en, if you didn't need it, you can use 9.0.0 version without any trouble.
open app/build.gradle
from your app-module and rewrite below line after dependencies block. This allows the plugin to determine what version of Play services you are using
apply plugin: 'com.google.gms.google-services'
I got this idea from here. In this tutorial second point is saying that above plugin line be at the bottom of your app/build.gradle
file so that no dependency collisions are introduced. Hope it will help you out.