Google PlayGames + Google Analytics

For the past few days, I’ve been facing a frustrating issue;
Google PlayGames and Google Analytics are working against each other in Unity3d. I can’t get both working at the same time.

The Issue

Google Analytics has the priority, in an effort to record more data on the player gameplay.
Google PlayGames would be a really neat addition to add in leaderboards and achievements for the test players, since they quickly add low-dev-effort gameplay value, even in smaller games.

Both work by themselves, without an issue. I got a Unity Package ready for both to implement and use directly. But if I use one, I cannot use the other.

The problem is quite simple. Google Analytics uses a library called google-play-services_lib. This library contains a .jar file, which contains a variety of plugin files that are required for Google services.

Google PlayGames figured implementing the whole jar file creates a too big footprint, which I really agree with. But to fix it, they simply delete the library and replace it with .aar files, which are the files contained within the .jar file (Maybe not exactly the same, but the same plugins, yes). But guess who needs that whole library to function… Right, Google Analytics.

Possible Solutions

One solution that came to mind is to have GooglePlayGames use the whole library instead. But this doesn’t seem to work. There is no real error, but GooglePlayGames refuses to authenticate.

The second solution that came to mind is to have GoogleAnalytics use the .aar files instead of the library. But to accomplish this, I need to know what .aar files GoogleAnalytics requires before I can add them. I don’t know this yet, but if I find out, I could theoretically solve the issue.

The third solution is to use both the library and the .aar files. However, if both are included in Unity, it throws a building error of failing to re-package resources. This means that there are conflicting files, and thát means that there are plugins within the library that are also included in the .aar files. You can’t have two of the same things, in different formats, trying to compile.

To solve this, the idea is to manually remove certain files from the .jar library that are already included in the .aar files. However, to do this, I need to know exactly what files to remove from the .jar library, and I don’t know this yet. If I find out, it could theoretically solve the issue as well.

What’s next?

So without really knowing in full what files I need to remove and throw around, I can’t solve this issue. I’ve decided to, for now, drop it and return to it later. In the meantime, I hope the following issue reports might help in my quest:

Until then; away with GooglePlayGames. I’ll continue working on other matters.

The first of which: analyze my large generic modular code base to figure out what the internal dependencies are, and figure out if I could possibly sell these modules on the Unity Asset Store to get a little income, feedback and help out other devs a bit.

One thought on “Google PlayGames + Google Analytics

  1. I suddenly noticed something with the timing of the app crash.

    Long story short, I followed what I noticed and managed to solve the issue. Google Analytics and Google PlayGames are now both working in my app. It was an incredibly simple solution, but during my quest for that solution, I broke something else. I believed the solution didn’t work, but it was something else that didn’t.

    Well, suddenly fixed the issue. Happy but confused about bugs magically dissapearing.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s