google-analytics-plugin: Android build fails: com.google.android.gms:play-services-analytics version need to be specified

Hi,

Right now com.google.android.gms:play-services-analytics:+ doesn’t explicitly specify a version number for the library which lead to a gradle conflict while using phonegap-plugin-push 2.0.0

Would you be ok to modify following line of plugin.xml?

Instead of

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

Specifying the use of version 11.0.1

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

This fix the conflict error.

Related issue phonegap-plugin-push: https://github.com/phonegap/phonegap-plugin-push/issues/1718

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22 (2 by maintainers)

Commits related to this issue

Most upvoted comments

@danwilson I’m working with the cordova-cli team to add the ability to include variables in the framework tag.

So right now you have:

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

and when it is done we can specify:

<preference name="PLAY_SERVICES" default="+"/>
<framework src="com.google.android.gms:play-services-analytics:$PLAY_SERVICES" />

but then users will be able to over-ride the play services version to match other plugins that depend on the same framework but pin a specific version.

I’ll send a PR when it’s ready.

@BhavikaP Glad to help 😃… Let me know how it goes!

@iPzard Thank you for the GA implementation without plugin. Will apply it and see how I go. We would need to add a script tag for https://www.google-analytics.com/analytics.js?

@BhavikaP and @spinninghamster (sorry for the late reply Spinning). I don’t remember the specifics. However! What I can do is post my exact code. Replace “UA-XXXXXXXXX-X” with your own code ID and it should work for you as well. This was a real pain for me when originally researching, so I hope this helps you guys as much as it did me!

Let me know how it goes, if you still can’t get it, I’ll dig a little deeper to see if there’s anything else.

<script>
        window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
        var GA_LOCAL_STORAGE_KEY = 'ga:clientId';
        ga('create', 'UA-XXXXXXXXX-X', {
          'storage': 'none',
          'clientId': localStorage.getItem(GA_LOCAL_STORAGE_KEY)
        });
        ga(function(tracker) {
          localStorage.setItem(GA_LOCAL_STORAGE_KEY, tracker.get('clientId'));
        });
        ga('set', 'checkProtocolTask', null);
        ga('send', 'pageview');
</script>

@peterpeterparker yeah, I’m just waiting for cordova-android 6.3.0 to get released. Currently going through the voting process at Apache.