cgisca / PGSGP

Play Games Services plugin for Godot Game Engine - Android
MIT License
217 stars 61 forks source link

Infrequent crash receiving activity result #45

Open RandomShaper opened 4 years ago

RandomShaper commented 4 years ago

I've gotten some crash reports like this:

java.lang.RuntimeException: 
  at android.app.ActivityThread.deliverResults (ActivityThread.java:4461)
  at android.app.ActivityThread.handleSendResult (ActivityThread.java:4503)
  at android.app.servertransaction.ActivityResultItem.execute (ActivityResultItem.java:49)
  at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1839)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:201)
  at android.app.ActivityThread.main (ActivityThread.java:6864)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:547)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:873)
Caused by: kotlin.UninitializedPropertyAccessException: 
  at io.cgisca.godot.gpgs.PlayGameServicesGodot.onMainActivityResult (PlayGameServicesGodot.kt:139)
  at org.godotengine.godot.Godot.onActivityResult (Godot.java:279)
  at android.app.Activity.dispatchActivityResult (Activity.java:7598)
  at android.app.ActivityThread.deliverResults (ActivityThread.java:4454)

(This corresponds to a slightly earlier version of the PGSGP code.)

This is weird, as it looks as if my game was getting the result of the Google sign-in activity before the plugin has been initialized, so before sign-in has been requested at all. My game initializes the plugin very early (from a singleton) and doesn't perform any sign-in or any other action on PGSGP until the flow reaches certain screen.

I'm clueless about why this is happening. I'm starting to wonder if a defensive null check would be good enough...

myood commented 3 years ago

Same here, happens quite often on my app release.

{code} java.lang.RuntimeException: at android.app.ActivityThread.deliverResults (ActivityThread.java:5471) at android.app.ActivityThread.handleSendResult (ActivityThread.java:5512) at android.app.servertransaction.ActivityResultItem.execute (ActivityResultItem.java:51) at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:149) at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:103) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2386) at android.os.Handler.dispatchMessage (Handler.java:107) at android.os.Looper.loop (Looper.java:213) at android.app.ActivityThread.main (ActivityThread.java:8178) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:513) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1101) Caused by: kotlin.UninitializedPropertyAccessException: at io.cgisca.godot.gpgs.PlayGameServicesGodot.onMainActivityResult (PlayGameServicesGodot.kt:139) at org.godotengine.godot.Godot.onActivityResult (Godot.java:280) at android.app.Activity.dispatchActivityResult (Activity.java:8413) at android.app.ActivityThread.deliverResults (ActivityThread.java:5464) {code}