Google Play Games Plugin (java.lang.ClassNotFoundException: com.google.android.gms.games.Games)

Hey! We’ve been using Play Games Plugin for almost half a month without any kind of problem. We could use it to log in, unlock achievements, and so on. However, a few days ago it stopped working. There’s not even the log in prompt. We have already tried these solutions:

  • Update to Unity 2020
  • Use a custom proguard file (as we read here on other issues) and tick the “release” box, then forced resolve
  • Change the code, using it on start and on a button, just in case it had something to do with trying to log in too soon. Also, we tried to isolate the issue by using prints
  • Checked the google and the google play consoles, even removed the google play services and set them from zero. We have two credentials, and both SHA-1 are fine (for both apks and google play downloads)
  • OAuth seems to be fine
  • Using logcat to debug the errors (image below)

The only thing we did on the project since it started working was to add In App Purchases, however, I don’t think it had anything to do.

Lastly, I was so sure everything was perfectly set up that I created a new project, and the same script is working flawlessly on it. We’ve run out of ideas, and we could use any help you could provide. If you need anything else, just ask for it ^^. We also posted it on their github, however, we thought some of you may have faced the same problem before and could give us a hand.

Hello.

Did you manage to solve the problem or understand why this error is being issued?

1 Like

Hi, just wondering if either of you figured this out? This is a top search result on Google so it would be great if a solution could be posted. Thanks!

As per the log it states the required classes are not found in the apk/aab. Look for the following

  1. Check if the dependency is successfully resolved or not
  2. Check if you have any obfuscation enabled (Proguard/R8)

Let me know if you need any help.

1 Like
  1. The resolution meter reaches 100%, but does not resolve as it is unable to fetch one dependency:
    "Resolution failed

Failed to fetch the following dependencies:
com.google.games:gpgs-plugin-support:+"

A similar issue to this: Resolution failed: Failed to fetch the following dependencies: com.google.games:gpgs-plugin-support:0+@aar · Issue #2012 · playgameservices/play-games-plugin-for-unity · GitHub
but their solution didn’t work for me, unfortunately.

  1. I have no minify options selected, and code stripping is disabled. Unity 2020.3.25f1

First try updating your External dependency manager to latest version by downloading from here and try resolving it.
If it doesn’t work,
Try giving a version number and see if its able to resolve. (for ex: com.google.games:gpgs-plugin-support:0.10.11)

2 Likes

I updated my External Dependency Manager, but that alone didn’t solve the issue.

How do I give it a number like that? Is there a file somewhere that I can modify?

It may not be the latest version as I found that version online. Basically, its just to see if its resolving properly or not. Surprisingly, I didn’t find it any where at maven.google.com

Hmm, okay. No, the updated external dependency manager still does not resolve successfully. I am going to make a new project and import everything one at a time. It’s terrible that Unity and/or Google have so many engine-breaking issues like this. It seems that every mobile game I make has something that sets back development by at least a few long days.

2 Likes

It turns out that it was an issue with my ExternalDependencyManager and a config file that caused it to fail resolution with this error:
"Resolution failed

Failed to fetch the following dependencies:
com.google.games:gpgs-plugin-support:+"

The issue was that my GooglePlayGamesPluginDependencies.xml was pointing to a directory that did not exist.
This comment’s fix worked for me:

3 Likes

Thank you.
I have the same issue and then uncheking Release in minify resolved the issue

i am using unity 2023.1.9f1 and GPGS GooglePlayGamesPlugin-0.11.01.unitypackage

Just Update progard.txt file under project setting below

-keep class com.google.android.gms.games.PlayGames { ; }
-keep class com.google.android.gms.games.leaderboard.* { ; }
-keep class com.google.android.gms.games.snapshot.* { ; }
-keep class com.google.android.gms.games.achievement.* { ; }
-keep class com.google.android.gms.games.event.* { ; }
-keep class com.google.android.gms.games.stats.* { ; }
-keep class com.google.android.gms.games.video.* { ; }
-keep class com.google.android.gms.games. { ; }
-keep class com.google.android.gms.common.api.ResultCallback { ; }
-keep class com.google.android.gms.signin. { ; }
-keep class com.google.android.gms.dynamic.* { ; }
-keep class com.google.android.gms.dynamite.* { ; }
-keep class com.google.android.gms.tasks.* { ; }
-keep class com.google.android.gms.security.* { ; }
-keep class com.google.android.gms.base.* { ; }
-keep class com.google.android.gms.actions.* { ; }
-keep class com.google.games.bridge.* { ; }
-keep class com.google.android.gms.common.ConnectionResult { ; }
-keep class com.google.android.gms.common.GooglePlayServicesUtil { ; }
-keep class com.google.android.gms.common.api. { ; }
-keep class com.google.android.gms.common.data.DataBufferUtils { ; }
-keep class com.google.android.gms.games.quest. { ; }
-keep class com.google.android.gms.nearby. { *; }

this will solve this error for me

but then i can’t show leaderboardUI show error for this you have to add below line after authentication
PlayGamesPlatform.Activate();

this will show leaderboard pop up also when hit leaderboard show button

Hello, I´m getting the same error and don´t know what else try. Already updated proguard file, runned resolver, etc. Im building and the build works fine in the device but when attempting to log in or show the leaderboard I get this error:

 AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.games.PlayGames
java.lang.ClassNotFoundException: com.google.android.gms.games.PlayGames
     at java.lang.Class.classForName(Native Method)
     at java.lang.Class.forName(Class.java:454)
     at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
     at com.unity3d.player.UnityPlayer.access$500(Unknown Source:0)
     at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:126)
     at android.os.Handler.dispatchMessage(Handler.java:102)
     at android.os.Looper.loopOnce(Looper.java:201)
     at android.os.Looper.loop(Looper.java:288)
     at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
Caused by: java.lang.ClassNotFoundException: com.google.android.gms.games.PlayGames
     ... 9 more
   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
   at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0 2

This is still happening :frowning: any idea?

I tried to solve this problem for a long time and finally succeeded. I tried a lot, but in the end the following helped: Assets → External Dependency Manager → Android Resolver → Force Resolve

Thanks for answering. Not in my case. Did this 100 times and it is always the same error.

I tried the force resolve probably over 100 times as well. The path in the GooglePlayGamesPluginDependencies.xml was correct, my dll’s were set up correctly as well. However, it turns our for me I had some unresolved libraries that was not fixed with force resolve. I fixed the issue by using the Android Resolve > Delete Resolved Libraries, then force resolving again. Somehow, that worked.
By the way, gpgs version 11.04 does not work for me either. I rolled back to version 10.14

Thank you for the comprehensive steps, wished it was linked from the Unity docs. What a pain to get this working as there is a string of items to resolve. If some are also not having their dependency manager resolve correctly this helped me.

I use GPGS v0.11.01 and was same error java.lang.ClassNotFoundException: com.google.android.gms.games.PlayGames.
Android Force Resolve failed with an error Failed to fetch the following dependencies: com.google.games:gpgs-plugin-support:+.
How did I fix it:

  • open the file Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml
  • change line Packages/com.google.play.games/Editor/m2repository to Assets/GooglePlayGames/com.google.play.games/Editor/m2repository
  • run Android Force Resolve
1 Like

Hi I tried to change this line of code in GooglePlayGamesPluginDependencies.xml form this
<repository>Packages/com.google.play.games/Editor/m2repository</repository>
to this
<repository>Assets/GooglePlayGames/com.google.play.games/Editor/m2repository</repository>
I hope this help you

I’m using unity 2022.3.4f1 and GooglePlayGamesPlugin-0.11.01
Tried all of the above and nothing worked for me.

I fixed the issue by add this line of code in Plugins/Android/mainTemplate.gradle

dependencies {
    implementation "com.google.android.gms:play-services-games-v2:+"
  }