cmackay / google-analytics-plugin

Cordova Google Analytics Plugin for Android & iOS
Apache License 2.0
89 stars 43 forks source link

COOL-751 Fix conflict with Google Firebase on Android #72

Closed AlexanderSychev closed 7 years ago

AlexanderSychev commented 7 years ago

Fix Android application building conflict with Google Firebase.

cmackay commented 7 years ago

Thanks for the PR! I am not sure what issues might come up in switching to using a custom gradle build with specific versions vs play-services-analytics as a framework config entry. Its seems for one this will require more maintenance around managing android dependency versions. I will have to look into this in more detail but it feels like it might not be the best approach for addressing incompatibilities with another library. I do appreciate you submitting the PR. Also if others have any comments on whether this should be integrated into the build, I welcome any feedback.

Thanks!

AlexanderSychev commented 7 years ago

Real case: If developer use your plugin with that: https://github.com/fechanique/cordova-plugin-fcm, Android application building will be failed with this error:

Execution failed for task ':app:processDebugGoogleServices'. Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.
cmackay commented 7 years ago

Thanks for the info. I believe it is a real case but I want to verify that this approach is the recommended approach prior to merging this. I will review this weekend and I should have more info then.

cmackay commented 7 years ago

I appreciate the pull request but I don't want to change the way I include the analytics analytics framework. Thanks!

petarov commented 7 years ago

I actually had a brief look on that as Firebase is something I'm interested in as well. IMO the problem seems to be with how the GoogleServicesPlugin is included with the cordova-plugin-fcm plugin. The Firebase documentation explicitly writes:

Then, in your module Gradle file (usually the app/build.gradle), add the apply plugin line at the bottom of the file to enable the Gradle plugin:

That is not what the generated platforms/android/build.gradle file looks like when the cordova-plugin-fcm plugin gets added to a project. The plugin is not applied at the bottom of the build.gradle as far as I see.

I do not yet have a solution, but currently it looks to me as this is not a problem that lies in the google-analytics-plugin plugin.