playgameservices / play-games-plugin-for-unity

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

getSnapshotsClient / GoogleSignInAccount must not be null #2972

Open 1n01raymond opened 3 years ago

1n01raymond commented 3 years ago

Unity 2019.4.8f GPGS 0.10.11

Managed Stack Trace:

java.lang.NullPointerException: GoogleSignInAccount must not be null com.google.android.gms.common.internal.Preconditions.checkNotNull(com.google.android.gms:play-services-basement@@17.1.1:11) com.google.android.gms.games.Games.getSnapshotsClient(com.google.android.gms:play-services-games@@20.0.1:110) com.unity3d.player.ReflectionHelper.nativeProxyInvoke(Native Method) com.unity3d.player.ReflectionHelper.a(Unknown Source) com.unity3d.player.ReflectionHelper$1.invoke(Unknown Source) java.lang.reflect.Proxy.invoke(Proxy.java:393) $Proxy10.onComplete(Unknown Source) com.google.android.gms.tasks.zzj.run(Unknown Source) android.os.Handler.handleCallback(Handler.java:739) android.os.Handler.dispatchMessage(Handler.java:95) android.os.Looper.loop(Looper.java:158) android.app.ActivityThread.main(ActivityThread.java:7224) java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) UnityEngine.AndroidJNISafe.CheckException () (at <00000000000000000000000000000000>:0) UnityEngine.AndroidJNISafe.CallStaticObjectMethod (System.IntPtr clazz, System.IntPtr methodID, UnityEngine.jvalue[] args) (at <00000000000000000000000000000000>:0) UnityEngine.AndroidJavaObject._CallStatic[ReturnType] (System.String methodName, System.Object[] args) (at <00000000000000000000000000000000>:0) GooglePlayGames.Android.AndroidSavedGameClient..ctor (GooglePlayGames.Android.AndroidClient androidClient, UnityEngine.AndroidJavaObject account) (at <00000000000000000000000000000000>:0) GooglePlayGames.Android.AndroidClient+<>c__DisplayClass18_1.b__1 (UnityEngine.AndroidJavaObject completeTask) (at <00000000000000000000000000000000>:0) System.Action1[T].Invoke (T obj) (at <00000000000000000000000000000000>:0) GooglePlayGames.Android.AndroidTaskUtils+TaskOnCompleteProxy1[T].onComplete (T result) (at <00000000000000000000000000000000>:0) System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <00000000000000000000000000000000>:0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <00000000000000000000000000000000>:0) UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, System.Object[] args) (at <00000000000000000000000000000000>:0) UnityEngine._AndroidJNIHelper.InvokeJavaProxyMethod (UnityEngine.AndroidJavaProxy proxy, System.IntPtr jmethodName, System.IntPtr jargs) (at <00000000000000000000000000000000>:0) Rethrow as TargetInvocationException: GooglePlayGames.Android.AndroidTaskUtils+TaskOnCompleteProxy`1[UnityEngine.AndroidJavaObject].onComplete(UnityEngine.AndroidJavaObject) UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, System.Object[] args) (at <00000000000000000000000000000000>:0) UnityEngine._AndroidJNIHelper.InvokeJavaProxyMethod (UnityEngine.AndroidJavaProxy proxy, System.IntPtr jmethodName, System.IntPtr jargs) (at <00000000000000000000000000000000>:0)

It only happens on certain devices. I think it will be similar to this issue. https://github.com/playgameservices/play-games-plugin-for-unity/issues/2800

ozdemir08 commented 3 years ago

That issue is different than yours. Your issue seems to be calling a saved game method without authentication/waiting for authentication to be done. We will add a protection for it and release the fix with the next release.

Kmess commented 3 years ago

We have several devices that run into this issue as well - we do not have any savegames call yet, we just add onto the PlayGamesClientConfiguration.Builder.

The callstack we see that gets reported

Exception on MC 0.5.1 b1615578307

AndroidJavaException: java.lang.NullPointerException: GoogleSignInAccount must not be nulljava.lang.NullPointerException: GoogleSignInAccount must not be null com.google.android.gms.common.internal.Preconditions.checkNotNull(com.google.android.gms:play-services-basement@@17.4.0:11) com.google.android.gms.games.Games.getSnapshotsClient(com.google.android.gms:play-services-games@@21.0.0:69) com.unity3d.player.ReflectionHelper.nativeProxyInvoke(Native Method) com.unity3d.player.ReflectionHelper.a(Unknown Source:0) com.unity3d.player.ReflectionHelper$1.invoke(Unknown Source:31) java.lang.reflect.Proxy.invoke(Proxy.java:1006) $Proxy16.onComplete(Unknown Source) com.google.android.gms.tasks.zzj.run(com.google.android.gms:play-services-tasks@@17.2.0:4) android.os.Handler.handleCallback(Handler.java:900) android.os.Handler.dispatchMessage(Handler.java:103) android.os.Looper.loop(Looper.java:219) android.app.ActivityThread.main(ActivityThread.java:8387) java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055) UnityEngine.AndroidJNISafe.CheckException () UnityEngine.AndroidJNISafe.CallStaticObjectMethod (System.IntPtr clazz, System.IntPtr methodID, UnityEngine.jvalue[] args) UnityEngine.AndroidJavaObject._CallStatic[ReturnType] (System.String methodName, System.Object[] args) GooglePlayGames.Android.AndroidSavedGameClient..ctor (GooglePlayGames.Android.AndroidClient androidClient, UnityEngine.AndroidJavaObject account) GooglePlayGames.Android.AndroidClient+<>c__DisplayClass18_1.b__1 (UnityEngine.AndroidJavaObject completeTask) System.Action1[T].Invoke (T obj) GooglePlayGames.Android.AndroidTaskUtils+TaskOnCompleteProxy1[T].onComplete (T result) System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, System.Object[] args) UnityEngine._AndroidJNIHelper.InvokeJavaProxyMethod (UnityEngine.AndroidJavaProxy proxy, System.IntPtr jmethodName, System.IntPtr jargs) Rethrow as TargetInvocationException: GooglePlayGames.Android.AndroidTaskUtils+TaskOnCompleteProxy`1[UnityEngine.AndroidJavaObject].onComplete(UnityEngine.AndroidJavaObject) UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, System.Object[] args) UnityEngine._AndroidJNIHelper.InvokeJavaProxyMethod (UnityEngine.AndroidJavaProxy proxy, System.IntPtr jmethodName, System.IntPtr jargs)

When we init: PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().EnableSavedGames().Build(); PlayGamesPlatform.InitializeInstance(config);

MichalDolezalAG commented 1 year ago

We have the same issue.

Unity: 2020.3.40f1 GPGS: 0.10.12

Saving to cloud is not permitted when user is not signed in

Managed Stack Trace:

java.lang.NullPointerException: GoogleSignInAccount must not be null
com.google.android.gms.common.internal.Preconditions.l(com.google.android.gms:play-services-basement@@18.1.0:1)
com.google.android.gms.games.Games.getSnapshotsClient(com.google.android.gms:play-services-games@@21.0.0:1)
com.unity3d.player.ReflectionHelper.nativeProxyInvoke(Native Method)
com.unity3d.player.ReflectionHelper.a(Unknown Source)
com.unity3d.player.ReflectionHelper$1.invoke(Unknown Source)
java.lang.reflect.Proxy.invoke(Proxy.java:397)
$Proxy13.onComplete(Unknown Source)
com.google.android.gms.tasks.zzi.run(com.google.android.gms:play-services-tasks@@18.0.2:1)
android.os.Handler.handleCallback(Handler.java:739)
android.os.Handler.dispatchMessage(Handler.java:95)
android.os.Looper.loop(Looper.java:135)
android.app.ActivityThread.main(ActivityThread.java:5264)
java.lang.reflect.Method.invoke(Native Method)
java.lang.reflect.Method.invoke(Method.java:372)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:900)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695)
UnityEngine.AndroidJNISafe.CheckException () (at <00000000000000000000000000000000>:0)
UnityEngine.AndroidJNISafe.CallStaticObjectMethod (System.IntPtr clazz, System.IntPtr methodID, UnityEngine.jvalue[] args) (at <00000000000000000000000000000000>:0)
UnityEngine.AndroidJavaObject._CallStatic[ReturnType] (System.String methodName, System.Object[] args) (at <00000000000000000000000000000000>:0)
GooglePlayGames.Android.AndroidSavedGameClient..ctor (GooglePlayGames.Android.AndroidClient androidClient, UnityEngine.AndroidJavaObject account) (at <00000000000000000000000000000000>:0)
GooglePlayGames.Android.AndroidClient+<>c__DisplayClass18_1.<Authenticate>b__1 (UnityEngine.AndroidJavaObject completeTask) (at <00000000000000000000000000000000>:0)
System.Action`1[T].Invoke (T obj) (at <00000000000000000000000000000000>:0)
GooglePlayGames.Android.AndroidTaskUtils+TaskOnCompleteProxy`1[T].onComplete (T result) (at <00000000000000000000000000000000>:0)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <00000000000000000000000000000000>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <00000000000000000000000000000000>:0)
UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, System.Object[] args) (at <00000000000000000000000000000000>:0)
UnityEngine._AndroidJNIHelper.InvokeJavaProxyMethod (UnityEngine.AndroidJavaProxy proxy, System.IntPtr jmethodName, System.IntPtr jargs) (at <00000000000000000000000000000000>:0)
Rethrow as TargetInvocationException: GooglePlayGames.Android.AndroidTaskUtils+TaskOnCompleteProxy`1[UnityEngine.AndroidJavaObject].onComplete(UnityEngine.AndroidJavaObject)
UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, System.Object[] args) (at <00000000000000000000000000000000>:0)
UnityEngine._AndroidJNIHelper.InvokeJavaProxyMethod (UnityEngine.AndroidJavaProxy proxy, System.IntPtr jmethodName, System.IntPtr jargs) (at <00000000000000000000000000000000>:0)