playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.46k stars 967 forks source link

Cannot authenticate on PlayGamesPlatform (java.lang.ClassNotFoundException: com.google.games.bridge.TokenFragment) #2397

Open Kendja opened 5 years ago

Kendja commented 5 years ago

Hi!

Any ideas how to fix this? Thanks for advance. Trying a second day to find a working solution.

code:

GooglePlayGames.BasicApi.PlayGamesClientConfiguration config = new GooglePlayGames.BasicApi.PlayGamesClientConfiguration.Builder()
        // requests an ID token be generated.  This OAuth token can be used to
        //  identify the player to other services such as Firebase.
        .RequestIdToken()
        .Build();

PlayGamesPlatform.InitializeInstance(config);
// recommended for debugging:
//PlayGamesPlatform.DebugLogEnabled = true;
// Activate the Google Play Games platform
PlayGamesPlatform.Activate();

Social.localUser.Authenticate((bool success) =>
{
    if (success) {
        // if we signed in successfully, load data from cloud
        Debug.Log("Login successful!");
    } else {
        // no need to show error message (error messages are shown automatically
        // by plugin)
        Debug.LogWarning("Failed to sign in with Google Play Games.");
    }
});

error stacktrace:

12-21 17:37:24.089 27195 27217 W Unity   : *** [Play Games Plugin DLL] 12/21/18 17:37:24 +03:00 ERROR: Exception launching token request: java.lang.ClassNotFoundException: com.google.games.bridge.TokenFragment
12-21 17:37:24.089 27195 27217 W Unity   :
12-21 17:37:24.089 27195 27217 W Unity   : (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
12-21 17:37:24.089 27195 27217 W Unity   :
12-21 17:37:24.089 27195 27217 W Unity   : *** [Play Games Plugin DLL] 12/21/18 17:37:24 +03:00 ERROR: UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: com.google.games.bridge.TokenFragment
12-21 17:37:24.089 27195 27217 W Unity   : java.lang.ClassNotFoundException: com.google.games.bridge.TokenFragment
12-21 17:37:24.089 27195 27217 W Unity   :      at java.lang.Class.classForName(Native Method)
12-21 17:37:24.089 27195 27217 W Unity   :      at java.lang.Class.forName(Class.java:453)
12-21 17:37:24.089 27195 27217 W Unity   :      at java.lang.Class.forName(Class.java:378)
12-21 17:37:24.089 27195 27217 W Unity   :      at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
12-21 17:37:24.089 27195 27217 W Unity   :      at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
12-21 17:37:24.089 27195 27217 W Unity   :      at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source:72)
12-21 17:37:24.089 27195 27217 W Unity   :      at android.os.MessageQueue.next(MessageQueue.java:395)
12-21 17:37:24.089 27195 27217 W Unity   :      at android.os.Looper.loop(Looper.java:160)
12-21 17:37:24.089 27195 27217 W Unity   :      at com.unity3d.player.UnityPlayer$e.run(Unknown Source:32)
12-21 17:37:24.089 27195 27217 W Unity   : Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.games.bridge.TokenFragment" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.mkarpenko.worldbox-lT5r01lCekmgxoLC4edISQ==/base.apk"],nativeLibraryDirectories=[/data/app/c
12-21 17:37:24.098 27195 27217 I Unity   : Using configuration builder objects
olehkuznetsov commented 5 years ago

Is this a latest plugin version 0.9.57? Is proguard disabled in build?

legas1 commented 5 years ago

Hello @olehkuznetsov, we encountering similar errors in 0.9.57:

12-27 17:12:48.404 10566 10594 W Unity   : *** [Play Games Plugin DLL] 12/27/18 17:12:48 +01:00 ERROR: Exception launching auth code request: java.lang.ClassNotFoundException: com.google.games.bridge.TokenFragment
12-27 17:12:48.404 10566 10594 W Unity   : UnityEngine.DebugLogHandler:Internal_Log()
12-27 17:12:48.404 10566 10594 W Unity   : UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
12-27 17:12:48.404 10566 10594 W Unity   : UnityEngine.Logger:Log(LogType, Object)
12-27 17:12:48.404 10566 10594 W Unity   : UnityEngine.Debug:LogWarning(Object)
12-27 17:12:48.404 10566 10594 W Unity   : GooglePlayGames.OurUtils.<>c__DisplayClass10_0:<e>b__0() (at ...\Assets\GooglePlayGames\OurUtils\Logger.cs:77)
12-27 17:12:48.404 10566 10594 W Unity   : GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() (at ...\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:135)
12-27 17:12:48.404 10566 10594 W Unity   :
12-27 17:12:48.404 10566 10594 W Unity   : (Filename: H Line: 0)
12-27 17:12:48.404 10566 10594 W Unity   :
12-27 17:12:48.453 10566 10594 W Unity   : *** [Play Games Plugin DLL] 12/27/18 17:12:48 +01:00 ERROR: UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: com.google.games.bridge.TokenFragment
12-27 17:12:48.453 10566 10594 W Unity   :   at UnityEngine.AndroidJNISafe.CheckException () [0x00091] in <004fc436a9154f7fab4df9679445af6c>:0
12-27 17:12:48.453 10566 10594 W Unity   :   at UnityEngine.AndroidJNISafe.CallStaticObjectMethod (System.IntPtr clazz, System.IntPtr methodID, UnityEngine.jvalue[] args) [0x00011] in <004fc436a9154f7fab4df9679445af6c>:0
12-27 17:12:48.453 10566 10594 W Unity   :   at UnityEngine.AndroidJavaObject._CallStatic[ReturnType] (System.String methodName, System.Object[] args) [0x002d6] in <004fc436a9154f7fab4df9679445af6c>:0
12-27 17:12:48.453 10566 10594 W Unity   :   at UnityEngine.AndroidJavaObject.CallStatic[ReturnType] (System.String methodName, System.Object[] args) [0x00001] in <004fc436a9154f7fab4df9679445af6c>:0
12-27 17:12:48.453 10566 10594 W Unity   :   at UnityEngine.AndroidJavaObject.FindClass (System.String name) [0x0001d] in <004fc436a9154f7fab4df9679445af6c>:0
12-27 17:12:48.453 10566 10594 W Unity   :   at UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) [0x00012] in <004fc436a9154f7fab4df9679445af6c>:0
12-27 17:12:48.453 10566 10594 W Unity   :   at UnityEngi

It worked in 0.9.55 on some devices even with this error which was already present...

Unity 2018.3.0f2, Proguard disabled, build system is Gradle

EDIT: Fixed by pull request.