PostHog / posthog-flutter

PostHog Flutter SDK
https://posthog.com/docs/libraries/flutter
MIT License
55 stars 37 forks source link

[Android] Attempt to invoke virtual method 'java.lang.String java.util.UUID.toString()' on a null object reference #89

Closed caseycrogers closed 8 months ago

caseycrogers commented 8 months ago

Version

4.1.0

Steps to Reproduce

  1. flutter pub add posthog_flutter
  2. Run on Android

Expected Result

App does not crash

Actual Result

App crashes and exits on launch.

Tested on real devices. Appearing in prod (I was dumb enough to ship the build while only having QA'd it on iOS, rollback is already inflight). Does not appear to be occurring on iOS.

Error log:

E/AndroidRuntime(32150): FATAL EXCEPTION: main
E/AndroidRuntime(32150): Process: com.dribble_game_mobile, PID: 32150
E/AndroidRuntime(32150): java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.util.UUID.toString()' on a null object reference
E/AndroidRuntime(32150):    at com.posthog.PostHog.buildProperties(PostHog.kt:256)
E/AndroidRuntime(32150):    at com.posthog.PostHog.capture(PostHog.kt:344)
E/AndroidRuntime(32150):    at com.posthog.PostHog$Companion.capture(PostHog.kt:743)
E/AndroidRuntime(32150):    at com.posthog.PostHogInterface$DefaultImpls.capture$default(PostHogInterface.kt:27)
E/AndroidRuntime(32150):    at com.posthog.android.internal.PostHogLifecycleObserverIntegration.onStart(PostHogLifecycleObserverIntegration.kt:57)
E/AndroidRuntime(32150):    at androidx.lifecycle.DefaultLifecycleObserverAdapter.onStateChanged(DefaultLifecycleObserverAdapter.kt:25)
E/AndroidRuntime(32150):    at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.kt:314)
E/AndroidRuntime(32150):    at androidx.lifecycle.LifecycleRegistry.forwardPass(LifecycleRegistry.kt:251)
E/AndroidRuntime(32150):    at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.kt:287)
E/AndroidRuntime(32150):    at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.kt:136)
E/AndroidRuntime(32150):    at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.kt:119)
E/AndroidRuntime(32150):    at androidx.lifecycle.ProcessLifecycleOwner.activityStarted$lifecycle_process_release(ProcessLifecycleOwner.kt:97)
E/AndroidRuntime(32150):    at androidx.lifecycle.ProcessLifecycleOwner$attach$1$onActivityPreCreated$1.onActivityPostStarted(ProcessLifecycleOwner.kt:160)
E/AndroidRuntime(32150):    at android.app.Activity.dispatchActivityPostStarted(Activity.java:1499)
E/AndroidRuntime(32150):    at android.app.Activity.performStart(Activity.java:9032)
E/AndroidRuntime(32150):    at android.app.ActivityThread.handleStartActivity(ActivityThread.java:4198)
E/AndroidRuntime(32150):    at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:225)
E/AndroidRuntime(32150):    at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:205)
E/AndroidRuntime(32150):    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:177)
E/AndroidRuntime(32150):    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:98)
E/AndroidRuntime(32150):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2685)
E/AndroidRuntime(32150):    at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(32150):    at android.os.Looper.loopOnce(Looper.java:230)
E/AndroidRuntime(32150):    at android.os.Looper.loop(Looper.java:319)
E/AndroidRuntime(32150):    at android.app.ActivityThread.main(ActivityThread.java:8913)
E/AndroidRuntime(32150):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(32150):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
E/AndroidRuntime(32150):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
marandaneto commented 8 months ago

@caseycrogers thanks for raising this, checking it right now.

marandaneto commented 8 months ago

Found out https://github.com/PostHog/posthog-android/pull/107/

marandaneto commented 8 months ago

https://github.com/PostHog/posthog-android/releases/tag/3.1.13 fixed it, it might take a few minutes to get the artifacts in maven central.