fechanique / cordova-plugin-fcm

Google FCM Push Notifications Cordova Plugin
623 stars 995 forks source link

Google play services compatibility #179

Open cesarlvielma opened 8 years ago

cesarlvielma commented 8 years ago

Hi Guys. I was tring to build a cordova app with this two plugins:

https://github.com/floatinghotpot/cordova-admob-pro/ https://github.com/fechanique/cordova-plugin-fcm

but something is wrong with google services version and i did get this error:

`Error: /home/cesar/Freelancer/gamerchampions/fleek/fleek-main/angular/platforms/android/gradlew: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception.

A possible fix that i found was replace in platforms/android/project.properties :

cordova.system.library.1=com.google.android.gms:play-services-ads:+ by cordova.system.library.1=com.google.android.gms:play-services-ads:9.2.0

i am not a plugin developer or something like that, What you think about a better solution for this?

Regards !

jorchg commented 8 years ago

@cesarlvielma I'm sorry but I don't think there is other fix for this yet. We are a lot of people having trouble mixing two or more plugins that needs the same package. For me it was fixed like that and I had no problem until now.

danielfnz commented 8 years ago

I have the same problem!

Trying to install FCM + ADMOB

cesarlvielma commented 8 years ago

@jorchg Thanks for your reply. You are using a 9.2.0 version and others plugins will be using latest version soon, I hope it do not affect your fix (and my fix).

@fonzaex I fixed it (not better solution ) with a fork of Admob plugin and replace this line in plugin.xml:

<framework src="com.google.android.gms:play-services-ads:+" /> by <framework src="com.google.android.gms:play-services-ads:9.2.0" />

obviously it push me to always use 9.2.0 version and i could have future problems with others plugins that uses latest versions.

danielfnz commented 8 years ago

@cesarlvielma Thanks! Works for me.

hermitdemschoenenleben commented 8 years ago

unfortunately, the new version of cordova google maps plugin really requires version 10 of google play services (it depends on new features), so using it together with fcm plugin is not possible at all until the fcm plugin allows newer versions :(

cesarlvielma commented 7 years ago

@floatinghotpot did you test your suggest solution? i mean, i get a error with + version number. Today i back to this problem because i am trying to add another plugin with :+ dependences.

Regards !

floatinghotpot commented 7 years ago

Cordova plugin.xml can handle "+" as latest version, while gradle file cannot.

Fork and modify plugin.xml, move the framework dependency from gradle file to plugin.xml: Replace

    <framework src="src/android/FCMPlugin.gradle" custom="true" type="gradleReference"/>

with

        <framework src="com.google.gms:google-services:+" />
        <framework src="com.google.firebase:firebase-core:+" />
        <framework src="com.google.firebase:firebase-messaging:+" />

Here is the build log of a test project.

iMac:testfcm liming$ cordova plugin ls
cordova-plugin-admobpro 2.25.0 "AdMob Plugin Pro"
cordova-plugin-extension 1.5.1 "Cordova Plugin Extension"
cordova-plugin-fcm 1.1.5 "FCMPlugin"
cordova-plugin-whitelist 1.3.1 "Whitelist"

iMac:testfcm liming$ cordova build
... ...
... ...
BUILD SUCCESSFUL

Total time: 25.808 secs
Built the following apk(s):
    /Users/liming/workspace/cordova-apps/testfcm/platforms/android/build/outputs/apk/android-debug.apk

I've created a pull request: https://github.com/fechanique/cordova-plugin-fcm/pull/198

cesarlvielma commented 7 years ago

Yeah @floatinghotpot i discovered that by my self yesterday. here a fork if any need to see that changes: https://github.com/cesarlvielma/cordova-plugin-fcm

etherny commented 7 years ago

Before 2.0.0 version of FCM fix in project.properties worked. But since 2.0.0 no fix in previous solutions do the job. This issue is come back. Found com.google.android.gms:play-services-ads:9.2.0, but version 9.0.0 is needed for the google-services plugin.

When i remove admobpro plugin, it works.

Thx for you help.

zarcode commented 7 years ago

Same problem here, with version 2.1.1 of fcm plugin

miketrebilcock commented 7 years ago

None of the above solutions worked for me.

In the end I found that in the build.gradle file there was a dependencies section near the bottom where (I guess) something had gathered all the dependencies together. The section had multiple entries for the same modules but with different versions. Android Studio even underlined them and told me that it was likely to cause a problem.

I removed the later versions leaving version 9.0.0 - which doesn't seem the right thing to do, but it's now building!

floatinghotpot commented 7 years ago

As google has offered two different admob SDK, one with firebase, another standalone, I've branched one for firebase, cordova-plugin-admobpro-firebase. Use this one if you use cordova-plugin-fcm, which use firebase features.

cyclonmaster-zz commented 6 years ago

working fine can compile Then i want to add unityads admob mediation. Everything already configured in admob.

Now, what does cordova-plugin-admob-unityads do actually? Is it needed if I want add unityads admob mediation?

I run command cordova plugin add cordova-plugin-admob-unityads

cordova build android

I get compile failed.

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':processDebugGoogleServices'.

    Please fix the version conflict either by updating the version of the google-s ervices plugin (information about the latest version is available at https://bin tray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.

Any hint? Thanks.

cyclonmaster-zz commented 6 years ago

plugin name="cordova-plugin-fcm" spec="^2.1.2" plugin name="cordova-plugin-admobpro-firebase" spec="^2.29.29" engine name="android" spec="^6.3.0"