Search code examples
unity-game-enginegoogle-play-gamesnosuchmethoderror

Unity3D Google Play Games: NoSuchMethodError when calling Authenticate


I am using Google Play Services Plugin for Unity3D from the following source https://github.com/playgameservices/play-games-plugin-for-unity

When I try to show my Leaderboards or Achievements I get this message:

It seems that the authenticate always returns false.

Right now the user is only able to log in to google play.

10-11 11:39:17.972 I/Unity (16208): AndroidJavaException: java.lang.NoSuchMethodError: no method with name='getClass' signature='()Ljava/lang/Object;' in class Lcom/google/android/gms/common/api/b; 10-11 11:39:17.972 I/Unity (16208): at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in :0 10-11 11:39:17.972 I/Unity (16208): at UnityEngine.AndroidJNISafe.GetMethodID (IntPtr obj, System.String name, System.String sig) [0x00000] in :0 10-11 11:39:17.972 I/Unity (16208): at UnityEngine._AndroidJNIHelper.GetMethodID (IntPtr jclass, System.String methodName, System.String signature, Boolean isStatic) [0x00000] in :0 10-11 11:39:17.972 I/Unity (16208): at UnityEngine.AndroidJNIHelper.GetMethodID (IntPtr javaClass, System.String methodName, System.String signature, Boolean isStatic) [0x00000] in :0 10-11 11:39:17.972 I/Unity (16208): at UnityEngine._AndroidJNIHelper.GetMethodIDAndroidJavaObject [0x00000] in :0 10-11 11:39:17.972 I/Unity (16208): at UnityEngine.AndroidJNIHelper.GetMethodID[AndroidJavaObject] (IntPtr jclass, System.String methodName, System.Object[] arg 10-11 11:39:19.617 W/ActivityManager(2155): Activity pause timeout for ActivityRecord{4232ec38 co.uk.gringames.hungrybobproject/com.unity3d.player.UnityPlayerNativeActivity} 10-11 11:39:38.747 I/Unity (16208): AndroidJavaException: java.lang.NoSuchMethodError: no method with name='getClass' signature='()Ljava/lang/Object;' in class Lcom/google/android/gms/common/api/b; 10-11 11:39:38.747 I/Unity (16208): at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in :0 10-11 11:39:38.747 I/Unity (16208): at UnityEngine.AndroidJNISafe.GetMethodID (IntPtr obj, System.String name, System.String sig) [0x00000] in :0 10-11 11:39:38.747 I/Unity (16208): at UnityEngine._AndroidJNIHelper.GetMethodID (IntPtr jclass, System.String methodName, System.String signature, Boolean isStatic) [0x00000] in :0 10-11 11:39:38.747 I/Unity (16208): at UnityEngine.AndroidJNIHelper.GetMethodID (IntPtr javaClass, System.String methodName, System.String signature, Boolean isStatic) [0x00000] in :0 10-11 11:39:38.747 I/Unity (16208): at UnityEngine._AndroidJNIHelper.GetMethodIDAndroidJavaObject [0x00000] in :0 10-11 11:39:38.747 I/Unity (16208): at UnityEngine.AndroidJNIHelper.GetMethodID[AndroidJavaObject] (IntPtr jclass, System.String methodName, System.Object[] arg

    //leaderboard strings
private string leaderboard = "sasaa";
//achievement strings

// Use this for initialization
void Awake()
{
    PlayGamesPlatform.Activate();
}

public void GooglePlayGames(string process)
{
    if (process == "login") {
                    Social.localUser.Authenticate ((bool success) =>
                    {
                            if (success) {
                                    Debug.Log ("You've successfully logged in");
                            } else {
                                    Debug.Log ("Login failed for some reason");
                            }
                    });
            } else if (process == "lead") {
        if (!Social.localUser.authenticated) {
        }else{
                ((PlayGamesPlatform)Social.Active).ShowLeaderboardUI (leaderboard);
        }
            }
}

Please Help!

Kind Regards,

Daniel


Solution

  • I ran into the same problem today. Apparently there was an update committed to the GitHub repository on the 13th (see https://github.com/playgameservices/play-games-plugin-for-unity/commit/eb70764bf8795de051520b3262745ef35c204c17#diff-bedb7e4c95811a7313c6e4ba5f18875f ) that appears to fix the problem. I merged all the changes from head and my app ran OK.