New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Analytics Compatibility #1057

Closed
DuskLightStudios opened this Issue Mar 19, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@DuskLightStudios
Copy link

DuskLightStudios commented Mar 19, 2016

I ran into an issue regarding the compatibility between Google Analytics and Google Play Games services. After a lot of experimenting and research, I've figured out that the issue is about the Google Play Services library.

Google Play Games removes this library and replaces it with .aar files. Theoretically a good idea, since it clears up a lot of app size. But it breaks Google Analytics, which needs that library to function.

I've tried including the analytics aar file into the dependencies, as described here:
googleanalytics/google-analytics-plugin-for-unity#51

But that didn't work. The result is that Google Play Games works, but the app crashes after a few seconds due to Google Analytics. My Google Analytics works great if Google Play Games is not included in the game.

A lot of people seem to have this issue, but there seems to be no clear solution for it anywhere. What can I do to fix this?

@DuskLightStudios

This comment has been minimized.

Copy link
Author

DuskLightStudios commented Mar 20, 2016

Problem resolved. I didn't expect to find it this quickly. Apologies for somewhat hastely posting about this issue!
I actually solved the issue awhile back, but I believed the solution didn't work because a completely different bug was crashing my app the entire time. So after solving that, I discovered my issue was already gone.

The only thing you need to do to get Google Analytics to work with Google PlayGames is:

  1. Install Google Analytics as described in their readme
  2. Install Google PlayGames as described in their readme
  3. Don't add the 'google-play-services_lib' folder in 'Assets/Plugins/Android', and if you did, simply delete it.
  4. Add the following code to GPGSDependencies.cs

svcSupport.DependOn("com.google.android.gms",
"play-services-analytics",
PluginVersion.PlayServicesVersionConstraint);

That should remove the compatibility issue, and allow you to run the code.
Do make sure both plugins work independently first. Otherwise, you might get a problem with one of them, and believe it's about compatibility.

@claywilkinson

This comment has been minimized.

Copy link
Contributor

claywilkinson commented Mar 21, 2016

Thanks for the issue and the update! I am glad you got it working.

@infosekr

This comment has been minimized.

Copy link

infosekr commented Mar 27, 2016

An additional step to add to the solution:
5. Right click on the Unity Project View. Select "Google Play Services | Resolve Client Jars"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment