playgameservices / play-games-plugin-for-unity

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

Crash when activating android application #1792

Open mkorotetsky opened 7 years ago

mkorotetsky commented 7 years ago

Hi, I have rare crash when I resume my application from background.

java.lang.Error: FATAL EXCEPTION [main] Unity version : 5.5.3p4 Device model : Sony D5503 Device fingerprint: Sony/D5503/D5503:5.1.1/14.6.A.1.236/2031203603:user/release-keys Caused by: java.lang.SecurityException: Not signed in when calling API at android.os.Parcel.readException(Parcel.java:1553) at android.os.Parcel.readException(Parcel.java:1505) at com.google.android.gms.games.internal.IGamesService$Stub$Proxy.zzuB(Unknown Source) at com.google.android.gms.games.internal.GamesClientImpl.zzuB(Unknown Source) at com.google.android.gms.common.internal.zzf$zzj.zzxG(Unknown Source) at com.google.android.gms.common.internal.zzf$zza.zzb(Unknown Source) at com.google.android.gms.common.internal.zzf$zza.zzu(Unknown Source) at com.google.android.gms.common.internal.zzf$zze.zzxH(Unknown Source) at com.google.android.gms.common.internal.zzf$zzd.handleMessage(Unknown Source) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:211) at android.app.ActivityThread.main(ActivityThread.java:5389) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)

claywilkinson commented 7 years ago

Can you share more of the log? Can you share steps to reproduce this?

JimmyDeemo commented 6 years ago

@mkorotetsky @claywilkinson Did anything come of this? We have a few hundred of these a day? Unfortunately I don't have any additional information other than the android version breakdown;

image

Any ideas on what sort of things to try to repro this crash? Could it be linked to the recent fix for stopping the GPG dialogue popping up on resume of application? Seen with Unity versions 5.4.5f1 and 2017.1.1p3.

DevByStarlight commented 6 years ago

@claywilkinson Seeing the same thing on Pixel XL2, Moto Z2, and other devices.

Environment:

Code runs fine most of the time - successful login, access google play games, etc. So it does not appear to be a proguard stripping of a class (ie, not seeing ClassNotFoundException).

In my local builds I can get it to happen fairly regularly. Most often when uninstall/reinstall when previous install had the player signed in to GPGS.

My crash stack mirrors the OP's.

Searching the magical internet shows this has been an issue for Google Games (not specifically Unity's plugin) for many years - as far back as 2012.

The apparent fix seems to be to force a disconnect via 'onActivityResult' (as per above SO posts). However, with the GPG unity plugin the access is sort of abstracted and we don't really implement anything java-side nor have access to the GPGS API client instance, etc.

Is there, perhaps, a missing a step in the plugin install add some handling in onActivityResult?

I do have a native plugin. And I can certainly extend the UnityPlayerNativeActivity to add something if necessary.

(Side note: App is in alpha with some friendly testers. I get a somewhat small but notable occurrence of these exceptions. Affects about 2-3% of my testers. In other words, would be very nice to get this fixed.)

Thanks in advance!