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.
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.
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.
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.