I have been getting this error and would love some help fixing it!
What’s Wrong:
I am trying to integrate Google Play Games into my Unity project. When I build an APK and attempt to log in, I get a class not found exception:
ClassNotFoundException: com.google.android.gms.games.PlayGames
I think this may be due to the fact that the External Dependency Manager is failing to resolve, giving the error in this question’s title:
Resolution failed
Failed to fetch the following dependencies:
com.google.games:gpgs-plugin-support:+
What I’m Using:
Unity 2020.3.35f1 w/ built-in JDK, SDK, and Gradle
Google Play Games 11.01
Firebase Auth & Firestore 9.1
Unity’s debug key for my unpublished app (the app is set up with the debug key in the Google Play Console)
What I’ve Tried:
Upgrading my Unity from 2020.3.25 to .3.35
Using a custom Proguard file
Downloading JDK 1.8 from Oracle and using that instead of the built-in
Re-importing the Google Play Games plugin after importing all the firebase plugins
Ensured that spec="com.google.games:gpgs-plugin-support:0.11.01"
is in my GooglePlayGamesPluginDependencies.xml.
Any ideas or help that anyone can offer? It seems a few people have similar issues but said issues never get resolved. (or when a solution is offered it doesn’t work)
3 Likes
The issue was that my GooglePlayGamesPluginDependencies.xml was pointing to a directory that did not exist.
This comment’s fix worked for me:
opened 03:42PM - 02 Dec 19 UTC
closed 08:44AM - 15 May 20 UTC
configuration
I'm trying to run the following code as part of an initialization function in my… game:
```C#
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
// enables saving game progress.
.EnableSavedGames()
// requests a server auth code be generated so it can be passed to an
// associated back end server application and exchanged for an OAuth token.
.RequestServerAuthCode(false)
// requests an ID token be generated. This OAuth token can be used to
// identify the player to other services such as Firebase.
.RequestIdToken()
.Build();
Debug.Log( $"GoogleGameManager, init: 1." );
PlayGamesPlatform.InitializeInstance(config);
// recommended for debugging:
Debug.Log( $"GoogleGameManager, init: 2." );
PlayGamesPlatform.DebugLogEnabled = true;
// Activate the Google Play Games platform
Debug.Log( $"GoogleGameManager, init: 3." );
PlayGamesPlatform.Activate();
Debug.Log( $"GoogleGameManager, init: 4." );
Social.localUser.Authenticate( (bool success) => {
// handle success or failure
Debug.Log( $"Social.localUser.Authenticate, success: {success}." );
if ( success )
{
((PlayGamesLocalUser)Social.localUser).GetStats((rc, stats) =>
{
// -1 means cached stats, 0 is succeess
// see CommonStatusCodes for all values.
if (rc <= 0 && stats.HasDaysSinceLastPlayed()) {
Debug.Log("It has been " + stats.DaysSinceLastPlayed + " days");
}
});
}
});
Debug.Log( $"GoogleGameManager, init: 5." );
```
The log showing the following results:
```log
2019-12-02 16:57:53.969 8017-8694/? I/Unity: GoogleGameManager, init: 1.
GoogleGameManager:init()
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
2019-12-02 16:57:53.969 8017-8772/? I/UnityAds: com.unity3d.services.core.configuration.InitializeThread$InitializeStateLoadCache.execute() (line:245) :: Unity Ads init: webapp loaded from local cache
2019-12-02 16:57:53.973 8017-8694/? I/Unity: GoogleGameManager, init: 2.
GoogleGameManager:init()
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
2019-12-02 16:57:53.975 8017-8694/? I/Unity: GoogleGameManager, init: 3.
GoogleGameManager:init()
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
2019-12-02 16:57:53.978 8017-8694/? I/Unity: GoogleGameManager, init: 4.
GoogleGameManager:init()
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
2019-12-02 16:57:53.988 8017-8694/? E/Unity: AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.games.Games
java.lang.ClassNotFoundException: com.google.android.gms.games.Games
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
at android.os.Handler.dispatchMessage(Handler.java:101)
at android.os.Looper.loop(Looper.java:164)
at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.games.Games" on path: DexPathList[[zip file "/data/app/com.sdfsdfsdfsd.jfgjfghjfgjfg-SEDFSDFGSDGSDGSDF-lA==/base.apk", zip file "/data/app/com.sdfsdfsdfsd.jfgjfghjfgjfg-SEDFSDFGSDGSDGSDF-lA==/split_config.arm64_v8a.apk"],nativeLibraryDirectories=[/data/app/com.sdfsdfsdfsd.jfgjfghjfgjfg-SEDFSDFGSDGSDGSDF
2019-12-02 16:57:53.997 8017-8017/? W/ResourceType: Found multiple library tables, ignoring...
2019-12-02 16:57:53.999 8017-8017/? I/WebViewFactory: Loading com.android.chrome version 78.0.3904.108 (code 390410837)
2019-12-02 16:57:54.001 8017-8694/? I/Unity: Initializing UnityPurchasing via Codeless IAP
UnityEngine.Purchasing.CodelessIAPStoreListener:CreateCodelessIAPStoreListenerInstance()
UnityEngine.Purchasing.CodelessIAPStoreListener:get_Instance()
UnityEngine.Purchasing.IAPListener:OnEnable()
```
It seems that Social.localUser.Authenticate causing the exception, and login to Google Games never appears. Everything else in my game works fine. I'm also using IAP and Ads packages by Unity.
I'm using PGPfU for the first time, so I'm not sure if I'm doing something wrong, or is it a bug.
Versions: PGPfU 0.10.06 from today, Unity 2019.2.14f, on Ubuntu 19.10 Linux 5.3.0-23-generic.
Any suggestions?
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
Thanks You So much. you saved my day.