playgameservices / play-games-plugin-for-unity

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

[Play Games Plugin DLL] ERROR: Exception launching token request: java.lang.ClassNotFoundException: com.google.games.bridge.TokenFragment #2587

Open jwoodall opened 5 years ago

jwoodall commented 5 years ago

I am having an issue where I can't get a connection to GooglePlayGames working, every time it tries to connect it throws this error. I have included the relevant snippet of the catlog below.

I am using Unity 2018.3.8f1 running on Windows, android platform.

The code is being called in an asynchronous function.

Code Snippet

        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
            .RequestServerAuthCode(false /* Don't force refresh */)
            .Build();
        try
        {
            PlayGamesPlatform.InitializeInstance(config);
            PlayGamesPlatform.Activate();
        }

Error Log

06-06 16:59:21.814 28685 28857 W Unity : GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() 06-06 16:59:21.814 28685 28857 W Unity : 06-06 16:59:21.814 28685 28857 W Unity : (Filename: ./Runtime/Export/Debug.bindings.h Line: 45) 06-06 16:59:21.814 28685 28857 W Unity : 06-06 16:59:21.828 28685 28857 W Unity : [Play Games Plugin DLL] 06/06/19 16:59:21 -07:00 ERROR: Exception launching token request: java.lang.ClassNotFoundException: com.google.games.bridge.TokenFragment 06-06 16:59:21.828 28685 28857 W Unity : GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() 06-06 16:59:21.828 28685 28857 W Unity : 06-06 16:59:21.828 28685 28857 W Unity : (Filename: ./Runtime/Export/Debug.bindings.h Line: 45) 06-06 16:59:21.828 28685 28857 W Unity : 06-06 16:59:21.830 28685 28857 W Unity : [Play Games Plugin DLL] 06/06/19 16:59:21 -07:00 ERROR: UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: com.google.games.bridge.TokenFragment 06-06 16:59:21.830 28685 28857 W Unity : at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0 06-06 16:59:21.830 28685 28857 W Unity : at UnityEngine.AndroidJNISafe.CallStaticObjectMethod (System.IntPtr clazz, System.IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <00000000000000000000000000000000>:0 06-06 16:59:21.830 28685 28857 W Unity : at UnityEngine.AndroidJavaObject._CallStatic[ReturnType] (System.String methodName, System.Object[] args) [0x00000] in <00000000000000000000000000000000>:0 06-06 16:59:21.830 28685 28857 W Unity : at UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) [0x00000] in <00000000000000000000000000000000>:0 06-06 16:59:21.830 28685 28857 W Unity : at GooglePlayGames.Android.AndroidTokenClient.DoFetchToken (System.Boolean silent, System.Action`1[T] callback) [0x00000] in <00000000000000000000000000000000>:0 06-06 16:59:21.830 28685 28857 W Unity : at GooglePlayGames.OurUtils.PlayGamesHelperObject.Update () [0x00000] in <00000000000000000000000000000000>:0 06-06 16:59:21.830 28685 28857 W Unity : GooglePlayG

amoswazana commented 5 years ago

Same here. Also using IL2CPP.

Versions: Google Play Games for Unity 0.9.64 Unity 2019.1.4f1 Firebase 6.0.0 Facebook 7.15.1

ADB Logcat: 2019-06-12 18:44:55.494 12384-12474/? W/Unity: *** [Play Games Plugin DLL] 06/12/19 18:44:55 +03:00 ERROR: Exception launching token request: java.lang.ClassNotFoundException: com.google.games.bridge.TokenFragment (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 48) 2019-06-12 18:44:55.495 12384-12474/? W/Unity: *** [Play Games Plugin DLL] 06/12/19 18:44:55 +03:00 ERROR: UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: com.google.games.bridge.TokenFragment at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.AndroidJNISafe.CallStaticObjectMethod (System.IntPtr clazz, System.IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.AndroidJavaObject._CallStatic[ReturnType] (System.String methodName, System.Object[] args) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) [0x00000] in <00000000000000000000000000000000>:0 at GooglePlayGames.Android.AndroidTokenClient.DoFetchToken (System.Boolean silent, System.Action1[T] callback) [0x00000] in <00000000000000000000000000000000>:0 at System.Action.Invoke () [0x00000] in <00000000000000000000000000000000>:0 at GooglePlayGames.OurUtils.PlayGamesHelpe `

jwoodall commented 5 years ago

So I was able to "get around" this issue, by playing with the android play services resolver.
Trying different combinations of:

I was eventually able to get it into a state where it would try to connect (an no longer throw this error).

Sorry for no clear "fix" my "solution" was trying over and over again different combinations of resolver calls and then one time it worked, and then continued to work.

BrokenHell commented 5 years ago

Hi , I experience the same problem , can you show me your gradle file ? as well as the library u're currently using :D

BrokenHell commented 5 years ago

It seems that gradle is not be able to copying com.google.games:gpgs-plugin-support:0.9.64 from Unity project. I had exported APK and check the classes.dex and there is no google play game there.

BrokenHell commented 5 years ago

Remove the using for gradle template and forced resolve can solve this problem

BrokenHell commented 5 years ago

Ok so turn off pro-guard and gradle template solved the bug

blahti commented 5 years ago

I have been trying to get my apps ready to be meet the August deadline for 64-bit compliance on Google Play. In doing that for my second game, I encountered the TokenFragment problem again. I thought for sure I had already taken steps that would avoid this by converting to 0.9.64 of the Play Games plugin setting up Gradle build and Proguard. Turns out I was mistaken. I still needed to update the unity-jar-resolver: https://github.com/googlesamples/unity-jar-resolver I updated to 1.2.117 and then did resolve (or Force Resolve).

So if you are using Gradle build and Proguard, try that.

zjinpeng commented 4 years ago

I have been trying to get my apps ready to be meet the August deadline for 64-bit compliance on Google Play. In doing that for my second game, I encountered the TokenFragment problem again. I thought for sure I had already taken steps that would avoid this by converting to 0.9.64 of the Play Games plugin setting up Gradle build and Proguard. Turns out I was mistaken. I still needed to update the unity-jar-resolver: https://github.com/googlesamples/unity-jar-resolver I updated to 1.2.117 and then did resolve (or Force Resolve).

So if you are using Gradle build and Proguard, try that.

unity-jar-resolver updare to 1.2.117 can resolve the problem