playgameservices / play-games-plugin-for-unity

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

ERROR: UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: com.google.games.bridge.HelperFragment #2871

Open E13-A opened 4 years ago

E13-A commented 4 years ago

Hello,

I just recently integrated GPGS (0.10.07 with play services resolver 1.2.135.0). The app runs ok but it doesn't authenticate and doesn't fire the callback with any errors. On inspecting the device log I found there is an exception which I'm sure is the problem.

2020-04-07 12:14:50.986 27196-27306/com.company.game W/Unity: !!! [Play Games Plugin DLL] 04/07/20 12:14:50 -07:00 WARNING: Creating new PlayGamesPlatform
    GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
2020-04-07 12:14:50.988 27196-27306/com.company.game I/Unity:  [Play Games Plugin DLL] 04/07/20 12:14:50 -07:00 DEBUG: Activating PlayGamesPlatform.
    GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
2020-04-07 12:14:50.989 27196-27306/com.company.game I/Unity:  [Play Games Plugin DLL] 04/07/20 12:14:50 -07:00 DEBUG: PlayGamesPlatform activated: GooglePlayGames.PlayGamesPlatform
    GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
2020-04-07 12:14:50.990 27196-27306/com.company.game I/Unity:  [Play Games Plugin DLL] 04/07/20 12:14:50 -07:00 DEBUG: Creating platform-specific Play Games client.
    GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
2020-04-07 12:14:50.991 27196-27306/com.company.game I/Unity:  [Play Games Plugin DLL] 04/07/20 12:14:50 -07:00 DEBUG: Creating Android IPlayGamesClient Client
    GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
2020-04-07 12:14:51.336 27196-27306/com.company.game W/Unity: *** [Play Games Plugin DLL] 04/07/20 12:14:51 -07:00 ERROR: Exception launching token request: java.lang.ClassNotFoundException: com.google.games.bridge.HelperFragment
    GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
2020-04-07 12:14:51.338 27196-27306/com.company.game W/Unity: *** [Play Games Plugin DLL] 04/07/20 12:14:51 -07:00 ERROR: UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: com.google.games.bridge.HelperFragment
    java.lang.ClassNotFoundException: com.google.games.bridge.HelperFragment
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:454)
        at java.lang.Class.forName(Class.java:379)
        at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
        at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
        at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source:72)
        at android.os.MessageQueue.next(MessageQueue.java:405)
        at android.os.Looper.loop(Looper.java:197)
        at com.unity3d.player.UnityPlayer$e.run(Unknown Source:32)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.games.bridge.HelperFragment" on path: DexPathList[[zip file "/data/app/com.company.game-fyDtdYdnKYaoifo8NuRPSw==/base.apk"],nativeLibraryDirectories=[/data/app/com.company.game-fyDtdYdnKYaoifo8NuRPSw==/lib/arm64, /data/app/com.j
2020-04-07 12:14:51.363 27196-27306/com.company.game W/Unity: *** [Play Games Plugin DLL] 04/07/20 12:14:51 -07:00 ERROR: Exception launching token request: java.lang.ClassNotFoundException: com.google.games.bridge.HelperFragment
    GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()

W/Unity: *** [Play Games Plugin DLL] 04/07/20 12:14:51 -07:00 ERROR: UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: com.google.games.bridge.HelperFragment
    java.lang.ClassNotFoundException: com.google.games.bridge.HelperFragment
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:454)
        at java.lang.Class.forName(Class.java:379)
        at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
        at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
        at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source:72)
        at android.os.MessageQueue.next(MessageQueue.java:405)
        at android.os.Looper.loop(Looper.java:197)
        at com.unity3d.player.UnityPlayer$e.run(Unknown Source:32)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.games.bridge.HelperFragment" on path: DexPathList[[zip file "/data/app/com.company.game-fyDtdYdnKYaoifo8NuRPSw==/base.apk"],nativeLibraryDirectories=[/data/app/com.company.game-fyDtdYdnKYaoifo8NuRPSw==/lib/arm64, /data/app/com.j

I browsed around online and found some results for similar issues back in early-mid last year, where the bug was fixed in the latest version and the recommended solution was just to update to the latest play services resolver. Now those recommended versions are already much older than what I've got here so that fix won't help me. Force resolving the libraries also did not help.

Can anyone provide some guidance in solving this issue?

Thanks and stay safe everybody,

ozdemir08 commented 4 years ago

First, please upgrade to v0.10.08, which fixes a bug.

Please check if you are using proguard to minimize your app. If you are using it and want to use it, make sure you read this section.

Let me know if this does not help.

E13-A commented 4 years ago

Hello Mehmet,

You were right about the proguard rules. When I disabled proguard, the exception went away, so I will be adding the new rules to our proguard file.

However, I had some problems updating from 0.10.07 to 0.10.08. Specifically, the jar resolver caused unity to hang indefinitely.

What I did was delete the PlayServicesResolver folder and then then GooglePlayGames folder, and then I imported the 0.10.08 unitypackage. After that, I could no longer force resolve libraries without causing Unity to hang.

I have decided the best thing for me do is to go back to a commit before I integrated GPGS. That way, I can simply integrate 0.10.08 from scratch.

So, before integrating GPGS, I have version 1.2.131 of the jar resolver. What is the correct course of action for integrating 0.10.08? Is it appropriate to delete the PlayServicesResolver folder before bringing in the 0.10.08 unitypackage?

Thanks!

ozdemir08 commented 4 years ago

Hi EJ, Deleting PlayServicesResolver and GooglePlayGames directories under Assets/, then importing 0.10.08 should be fine. Can you try it and let me know if Unity still hangs after that?

eaugustinowiczJC commented 4 years ago

Hi Mehmet,

Thanks for the info. At first, the resolver froze again after running the setup for 0.10.08. However, I think I found the pattern and I was able to get the libraries resolved. My guess is that switching away from the Unity window and then returning focus to Unity while it is resolving can sometimes cause Unity to compile scripts (as indicated by the lock icon and then the spinning loading icon at the bottom right on the status bar).

Any time that this happens during resolving, it seems Unity can not recover. As long as I remain focused on the Unity window throughout the duration of the resolving process, that recompile doesn't happen. But that's just a theory.

olehkuznetsov commented 4 years ago

Thanks for the update. We will try to reproduce it this way.

tolean commented 4 years ago

I have the same error with plugin v0.10.10

08-31 01:16:51.641: I/Unity(17380): Starting Auth with token client.
08-31 01:16:51.641: I/Unity(17380): GooglePlayGames.Android.AndroidClient:Authenticate(Boolean, Action`1)
08-31 01:16:51.641: I/Unity(17380): UnityEngine.Events.UnityAction:Invoke()
08-31 01:16:51.641: I/Unity(17380): UnityEngine.Events.UnityEvent:Invoke()
08-31 01:16:51.641: I/Unity(17380): UnityEngine.EventSystems.EventFunction`1:Invoke(T1, BaseEventData)
08-31 01:16:51.641: I/Unity(17380): UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
08-31 01:16:51.641: I/Unity(17380): UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
08-31 01:16:51.641: I/Unity(17380): UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
08-31 01:16:51.641: I/Unity(17380): UnityEngine.EventSystems.StandaloneInputModule:Process()
08-31 01:16:51.641: I/Unity(17380):  
08-31 01:16:51.641: I/Unity(17380): (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
08-31 01:16:51.658: W/Unity(17380): *** [Play Games Plugin 0.10.10] 08.31.20 1:16:51 +03:00 ERROR: Exception launching token request: java.lang.ClassNotFoundException: com.google.games.bridge.HelperFragment
08-31 01:16:51.658: W/Unity(17380): System.Action:Invoke()
08-31 01:16:51.658: W/Unity(17380): GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()
08-31 01:16:51.658: W/Unity(17380):  
08-31 01:16:51.658: W/Unity(17380): (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
08-31 01:16:51.660: W/Unity(17380): *** [Play Games Plugin 0.10.10] 08.31.20 1:16:51 +03:00 ERROR: UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: com.google.games.bridge.HelperFragment
08-31 01:16:51.660: W/Unity(17380):   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0 
08-31 01:16:51.660: W/Unity(17380):   at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0 
08-31 01:16:51.660: W/Unity(17380):   at UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) [0x00000] in <00000000000000000000000000000000>:0 
08-31 01:16:51.660: W/Unity(17380):   at GooglePlayGames.Android.AndroidTokenClient.DoFetchToken (System.Boolean silent, System.Action`1[T] callback) [0x00000] in <00000000000000000000000000000000>:0 
08-31 01:16:51.660: W/Unity(17380):   at System.Action.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
08-31 01:16:51.660: W/Unity(17380):   at GooglePlayGames.OurUtils.PlayGamesHelperObject.Update () [0x00000] in <00000000000000000000000000000000>:0 
08-31 01:16:51.660: W/Unity(17380): System.Action:Invoke()
08-31 01:16:51.660: W/Unity(17380): GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()
08-31 01:16:51.660: W/Unity(17380):  
08-31 01:16:51.660: W/Unity(17380): (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
msaqlain commented 1 year ago

Any solution?

longshilin commented 5 months ago

Ref: https://github.com/googlesamples/unity-jar-resolver/issues/208