AppsFlyerSDK / appsflyer-flutter-plugin

Flutter Plugin for AppsFlyer SDK
MIT License
152 stars 120 forks source link

The app crashes due to NullPointerException #329

Open artyom-frolov opened 4 months ago

artyom-frolov commented 4 months ago

Describe the bug After integrating the AppsFlyer SDK into our Flutter app, some Android users experience crashes. No special actions are required from the user to reproduce the bug. This issue is similar to #322 but our app doesn't use deeplinks and has a different call stack.

Callstack:

Exception java.lang.NullPointerException:
  at com.appsflyer.appsflyersdk.AppsflyerSdkPlugin$5$1.run (AppsflyerSdkPlugin.java:384)
  at android.os.Handler.handleCallback (Handler.java:914)
  at android.os.Handler.dispatchMessage (Handler.java:100)
  at android.os.Looper.loop (Looper.java:224)
  at android.app.ActivityThread.main (ActivityThread.java:7551)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:539)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:995)

To Reproduce We cannot identify specific reproducible steps; the issue occurs unexpectedly.

Expected behavior The app should work without crashes.

Screenshots Callstack from Sentry:

Sentry

Smartphone:

Additional context AppsFlyer SDK version: 6.13.2+1 Flutter version: 3.13.9 (stable) Engine revision 0545f8705d Dart version: 3.1.5 DevTools version: 2.25.0 IDE: VS Code (version 1.90.2)

github-actions[bot] commented 4 months ago

👋 Hi @artyom-frolov and Thank you for reaching out to us. In order for us to provide optimal support, please submit a ticket to our support team at support@appsflyer.com. When submitting the ticket, please specify:

MahendraN35 commented 4 months ago

We are facing the same problem too and we are using appsflyer_sdk (6.14.3).

RonyBrosh commented 4 months ago

As a quick fix we reverted our AppsFlyer version update back to 6.13.0+1. We never had those crashes with that version but keep in mind that deferred deep links won't work for you on iOS with that version of AppsFlyer. They will on Android though.

artyom-frolov commented 3 months ago

I conacted with support. Their response: "I discussed this issue the mobile team and based on the error trace and shared code snippet It seems like we have an issue with the new startSDK method with onSuccess and onError callbacks here. As a workaround, we can suggest removing the callbacks on the Flutter side if they are not in use in your app logic and using startSDK without the callback."

I'll try this workaround. Maybe it will help someone too.