playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.45k stars 962 forks source link

GamesNativeSDK: Can't register class com/google/android/gms/games/PlayerLevel: an exception occurred. #2259

Open ceceomer opened 6 years ago

ceceomer commented 6 years ago

Hello, I tried to solve that problem but i couldn't it. What can i do?

GamesNativeSDK: Can't register class com/google/android/gms/games/PlayerLevel: an exception occurred.

(Filename: ./Runtime/Export/Debug.bindings.h Line: 43) 08-05 22:49:05.581 15066-15080/? E/GamesNativeSDK: Could not register one or more required Java classes. 08-05 22:49:05.632 15066-15080/? E/Unity: InvalidOperationException: There was an error creating a GameServices object. Check for log errors from GamesNativeSDK at GooglePlayGames.Native.PInvoke.GameServicesBuilder.Build (GooglePlayGames.Native.PInvoke.PlatformConfiguration configRef) [0x00000] in :0 at GooglePlayGames.Native.NativeClient.InitializeGameServices () [0x00000] in :0 at GooglePlayGames.Native.NativeClient.m0 (Int32 result) [0x00000] in :0 at GooglePlayGames.Android.AndroidTokenClient+cAnonStorey1.<>m__0 (Int32 rc, System.String authCode, System.String email, System.String idToken) [0x00000] in :0 at GooglePlayGames.Android.TokenResultCallback.OnResult (GooglePlayGames.Android.TokenResult arg_Result_1) [0x00000] in :0 at Com.Google.Android.Gms.Common.Api.ResultCallbackProxy`1[R].onResult (UnityEngine.AndroidJavaObject arg_Result_1) [0x00000] in :0 at System.Reflection.MonoMethod.I

AAR files

ceceomer commented 6 years ago

Is there anyone?

Nathisgreen commented 6 years ago

Hi @ceceomer. I have exact same problem. Did you ever find a solution?

ceceomer commented 6 years ago

Hi @ceceomer. I have exact same problem. Did you ever find a solution?

Hi, No i didn't. I'm still waiting new version :/

macagu commented 6 years ago

I was having the same issue... i solved it by manually deleting gradle cache.

Delete the folder: _C:\Users\YOURUSER.gradle

Rebuild, and hopely enjoy!

Nathisgreen commented 6 years ago

Hi @macagu. I tried your suggestion (first just deleting the cache folder and then the entire .gradle folder, and running the resolver after each try) and it seems to have made no difference. Are you sure you didn't do anything else when you fixed the problem for yourself?

macagu commented 6 years ago

I'm sorry... i'm having the same issue again... i can't figure out what happened... maye its related to the Resolver magic?

macagu commented 6 years ago

Mmm... i got it working again. I'm not sure what is causing or solving this issue.

Here are the bunch of steps i've made:

Trying with Android Studio...

Back to Unity...

I'm guessing its related to Play Services Resolver WHILE building with Gradle. Maybe files gets deleted while gradle is building? ... therefore they are not copied/included in the apk? Maybe (under some circumstances) its related to Use Gradle Daemon on Play Services Resolver > Android Resolver > Settings?

Here is my config:

Nathisgreen commented 5 years ago

Hi @macagu. I appreciate the thorough reply. I have tried a bunch of the things you did and still haven't had any luck. One thing to note is the internal build wont compile for me, and tracking down what exactly the error is has proven difficult. Are you definitely getting this exact error (with the first one being Playerlevel). As there seems to be a few threads on 'GamesNativeSDK: Can't register class' but with different classes. Not sure if they are different to resolve but the other threads haven't helped me either.

macagu commented 5 years ago

The error i originally stumbled with was: GamesNativeSDK: Can't register class com/google/android/gms/games/Games

At first, i googled it and found many results related to GamesNativeSDK registering clases (not specially "Games"). Maybe not all these exceptions are caused by the same issue (i don't know).

So yes, maybe we are facing different issues that requires different resolutions.

Kendja commented 5 years ago

@ceceomer @macagu Hi! Have you found a solution?