Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: v3.5.3 crashes when trying to initialize #934

Open
3 tasks done
TheMeanCanEHdian opened this issue Aug 18, 2024 · 3 comments
Open
3 tasks done

[Bug]: v3.5.3 crashes when trying to initialize #934

TheMeanCanEHdian opened this issue Aug 18, 2024 · 3 comments

Comments

@TheMeanCanEHdian
Copy link

TheMeanCanEHdian commented Aug 18, 2024

What happened?

I am in the progress of updating my app. However, when OneSignal v3 tries to initialize it is crashing.

I am using Flutter v3.24.0.

Steps to reproduce?

1. Run SDK v3.5.3
2. Attempt to initialize OneSignal

What did you expect to happen?

I expect OneSignal to initialize successfully

OneSignal Flutter SDK version

3.4.3

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

Launching lib/main.dart on HD1905 in debug mode...
✓ Built build/app/outputs/flutter-apk/app-debug.apk
D/ViewRootImpl[FlutterActivity](19538):  debugCancelDraw some OnPreDrawListener onPreDraw return false,cancelDraw=true,count=50,android.view.ViewRootImpl@b9d2046
Connecting to VM Service at ws://127.0.0.1:64139/BMQNawcmI7c=/ws
Connected to the VM Service.
I/flutter (19538): [🌎 Easy Localization] [DEBUG] Localization initialized
I/Quality (19538): Skipped: false 3 cost 37.476578 refreshRate 0 processName com.tautulli.tautulli_remote
I/flutter (19538): [🌎 Easy Localization] [DEBUG] Start
I/flutter (19538): [🌎 Easy Localization] [DEBUG] Init state
I/flutter (19538): [🌎 Easy Localization] [DEBUG] Build
I/flutter (19538): [🌎 Easy Localization] [DEBUG] Init Localization Delegate
I/flutter (19538): [🌎 Easy Localization] [DEBUG] Init provider
I/flutter (19538): [🌎 Easy Localization] [DEBUG] Load Localization Delegate
D/SurfaceComposerClient(19538): VRR [FRTC] client handle [bufferId:18446744073709551615 framenumber:0] [ffffffff, ffffffff]
D/SurfaceComposerClient(19538): VRR [FRTC] client handle [bufferId:18446744073709551615 framenumber:0] [ffffffff, ffffffff]
D/ViewRootImpl[FlutterActivity](19538):  debugCancelDraw  cancelDraw=false,count = 342,android.view.ViewRootImpl@b9d2046
E/OneSignal(19538): Waiting for remote params. Moving setLocationShared() operation to a pending task queue.
D/OneSignal(19538): Adding a task to the pending queue with ID: 1
I/flutter (19538): [ShorebirdCodePush]: Shorebird Engine not available, using no-op implementation.
V/OneSignal(19538): Initializing the OneSignal Flutter SDK (3.3.2)
D/OneSignal(19538): Adding a task to the pending queue with ID: 1
D/OneSignal(19538): startPendingTasks with task queue quantity: 1
D/OneSignal(19538): OneSignal InAppMessageTracker initInfluencedTypeFromCache: OSChannelTracker{tag=iam_id, influenceType=UNATTRIBUTED, indirectIds=null, directId=null}
D/OneSignal(19538): OneSignal NotificationTracker initInfluencedTypeFromCache: OSChannelTracker{tag=notification_id, influenceType=UNATTRIBUTED, indirectIds=null, directId=null}
D/OneSignal(19538): OneSignal getUnattributedUniqueOutcomeEventsSentByChannel: null
W/OneSignal(19538): appContext set, but please call setAppId(appId) with a valid appId to complete OneSignal init!
V/OneSignal(19538): setAppId called with id: 3b4b666a-d557-4b92-acdf-e2c8c4b95357 changing id from: null
V/OneSignal(19538): Starting OneSignal initialization!
V/OneSignal(19538): Found class: com.tautulli.tautulli_remote.NotificationServiceExtension, attempting to call constructor
V/OneSignal(19538): OneSignal SDK initialization delayed, waiting for remote params.
D/OneSignal(19538): Starting request to get Android parameters.
D/OneSignal(19538): OneSignalRestClient: Making request to: https://api.onesignal.com/apps/3b4b666a-d557-4b92-acdf-e2c8c4b95357/android_params.js
D/OneSignal(19538): Attempted to clean 6 month old IAM data, but none exists!
W/SQLiteLog(19538): (28) double-quoted string literal: "notification"
D/OneSignal(19538): Retrieved IAMs from DB redisplayedInAppMessages: []
I/OneSignal(19538): Last Pending Task has ran, shutting down
V/OneSignal(19538): OneSignalRestClient: After con.getResponseCode to: https://api.onesignal.com/apps/3b4b666a-d557-4b92-acdf-e2c8c4b95357/android_params.js
D/OneSignal(19538): OneSignalRestClient: Successfully finished request to: https://api.onesignal.com/apps/3b4b666a-d557-4b92-acdf-e2c8c4b95357/android_params.js
D/OneSignal(19538): OneSignalRestClient: GET RECEIVED JSON: {"awl_list":{},"android_sender_id":"159358117861","chnl_lst":[],"fba":true,"outcomes":{"direct":{"enabled":false},"indirect":{"notification_attribution":{"minutes_since_displayed":60,"limit":10},"enabled":false},"unattributed":{"enabled":false}},"receive_receipts_enable":false}
D/OneSignal(19538): OneSignalRestClient: Response has etag of W/"7580f17807072dc0c4b8ee52eccd1e7b" so caching the response.
D/OneSignal(19538): OneSignal saveInfluenceParams: InfluenceParams{indirectNotificationAttributionWindow=60, notificationLimit=10, indirectIAMAttributionWindow=1440, iamLimit=10, directEnabled=false, indirectEnabled=false, unattributedEnabled=false}
D/OneSignal(19538): reassignDelayedInitParams with appContext: android.app.Application@e871fbf
V/OneSignal(19538): setAppId called with id: 3b4b666a-d557-4b92-acdf-e2c8c4b95357 changing id from: null
V/OneSignal(19538): Starting OneSignal initialization!
V/OneSignal(19538): Found class: com.tautulli.tautulli_remote.NotificationServiceExtension, attempting to call constructor
D/OneSignal(19538): OneSignal handleActivityLifecycleHandler inForeground: true
D/OneSignal(19538): Application foregrounded focus time: 22154895
D/OneSignal(19538): App id set for first time:  3b4b666a-d557-4b92-acdf-e2c8c4b95357
E/AndroidRuntime(19538): FATAL EXCEPTION: OS_REST_SUCCESS_CALLBACK
E/AndroidRuntime(19538): Process: com.tautulli.tautulli_remote, PID: 19538
E/AndroidRuntime(19538): java.lang.NullPointerException: null receiver
E/AndroidRuntime(19538): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(19538): 	at com.onesignal.TrackAmazonPurchase.<init>(TrackAmazonPurchase.java:77)
E/AndroidRuntime(19538): 	at com.onesignal.OneSignal.handleAmazonPurchase(OneSignal.java:985)
E/AndroidRuntime(19538): 	at com.onesignal.OneSignal.init(OneSignal.java:863)
E/AndroidRuntime(19538): 	at com.onesignal.OneSignal.setAppId(OneSignal.java:736)
E/AndroidRuntime(19538): 	at com.onesignal.OneSignal.reassignDelayedInitParams(OneSignal.java:1181)
E/AndroidRuntime(19538): 	at com.onesignal.OneSignal.onRemoteParamSet(OneSignal.java:890)
E/AndroidRuntime(19538): 	at com.onesignal.OneSignal$7.complete(OneSignal.java:1122)
E/AndroidRuntime(19538): 	at com.onesignal.OneSignalRemoteParams.processJson(OneSignalRemoteParams.java:211)
E/AndroidRuntime(19538): 	at com.onesignal.OneSignalRemoteParams.access$100(OneSignalRemoteParams.java:12)
E/AndroidRuntime(19538): 	at com.onesignal.OneSignalRemoteParams$1.onSuccess(OneSignalRemoteParams.java:156)
E/AndroidRuntime(19538): 	at com.onesignal.OneSignalRestClient$5.run(OneSignalRestClient.java:284)
E/AndroidRuntime(19538): 	at java.lang.Thread.run(Thread.java:1012)
I/OneSignal(19538): Restoring notifications
I/OneSignal(19538): Querying DB for notifications to restore: created_time > 1723405820 AND dismissed = 0 AND opened = 0 AND is_summary = 0 AND expire_time > 1724010620
I/WM-WorkerWrapper(19538): Worker result SUCCESS for Work [ id=503ea06e-a415-40c0-a566-72e3f019db01, tags={ com.onesignal.OSNotificationRestoreWorkManager$NotificationRestoreWorker } ]
I/Process (19538): Sending signal. PID: 19538 SIG: 9
Lost connection to device.

Exited.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jennantilla
Copy link
Contributor

Hi @TheMeanCanEHdian thanks for reaching out! I see you are on an older version of our SDK; we'll look into reproducing this on v3, but I wanted to flag that we currently have an updated major release with many improvements and enhancements. I'd suggest checking out our Migration Guide and upgrading as this should resolve this error.

Please let us know if you have any additional questions or concerns!

@TheMeanCanEHdian
Copy link
Author

Hi @jennantilla,

Thank you for the reply. I have tried migrating to v5, but I have also run into issues there with the Notification Service Extension. I opened a bug report here:
OneSignal/OneSignal-Android-SDK#2178

@TheMeanCanEHdian
Copy link
Author

@jennantilla I have isolated the issue to an interaction between OneSignal and PurchasesFlutter. I have tested OneSignal v3.5.3 against PurchasesFlutter v6.29.2 (recommended on issue #694), v6.30.2 (the latest on their old SDK), and v8.1.1 (the latest on the newest SDK).

Here is an example app for Android that adds minimal code to get OneSignal to initialize and simply has the PurchasesFlutter dependency included in the pubspec.

Removing PurchasesFlutter from the pubspec or disabling the OneSignal initialization prevents this issue.

Added OneSignal Code:

Added PurchasesFlutter Code:

Debug Output

Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
✓ Built build/app/outputs/flutter-apk/app-debug.apk
Connecting to VM Service at ws://127.0.0.1:54501/vTcqqjT-lRw=/ws
Connected to the VM Service.
I/signal_v3_crash(31114): Compiler allocated 4579KB to compile void android.view.ViewRootImpl.performTraversals()
V/OneSignal(31114): Initializing the OneSignal Flutter SDK (3.3.2)
D/OneSignal(31114): Adding a task to the pending queue with ID: 1
D/OneSignal(31114): startPendingTasks with task queue quantity: 1
D/OneSignal(31114): Retrieved IAMs from DB redisplayedInAppMessages: []
I/OneSignal(31114): Last Pending Task has ran, shutting down
D/OneSignal(31114): OneSignal InAppMessageTracker initInfluencedTypeFromCache: OSChannelTracker{tag=iam_id, influenceType=UNATTRIBUTED, indirectIds=null, directId=null}
D/OneSignal(31114): OneSignal NotificationTracker initInfluencedTypeFromCache: OSChannelTracker{tag=notification_id, influenceType=UNATTRIBUTED, indirectIds=null, directId=null}
D/OneSignal(31114): OneSignal getUnattributedUniqueOutcomeEventsSentByChannel: []
V/OneSignal(31114): appContext set and cached app id found, calling setAppId with: 3b4b666a-d557-4b92-acdf-e2c8c4b95357
V/OneSignal(31114): setAppId called with id: 3b4b666a-d557-4b92-acdf-e2c8c4b95357 changing id from: null
V/OneSignal(31114): Starting OneSignal initialization!
V/OneSignal(31114): No class found, not setting up OSRemoteNotificationReceivedHandler
V/OneSignal(31114): OneSignal SDK initialization delayed, waiting for remote params.
D/OneSignal(31114): Starting request to get Android parameters.
D/OneSignal(31114): Attempted to clean 6 month old IAM data, but none exists!
W/SQLiteLog(31114): (28) double-quoted string literal: "notification"
V/OneSignal(31114): setAppId called with id: 3b4b666a-d557-4b92-acdf-e2c8c4b95357 changing id from: null
V/OneSignal(31114): Starting OneSignal initialization!
V/OneSignal(31114): No class found, not setting up OSRemoteNotificationReceivedHandler
V/OneSignal(31114): OneSignal SDK initialization delayed, waiting for remote params.
D/OneSignal(31114): OneSignalRestClient: Making request to: https://api.onesignal.com/apps/3b4b666a-d557-4b92-acdf-e2c8c4b95357/android_params.js?player_id=daf6c791-ef16-4e70-b675-52a2d8a27f3b
D/OneSignal(31114): OneSignalRestClient: Adding header if-none-match: W/"7580f17807072dc0c4b8ee52eccd1e7b"
D/TrafficStats(31114): tagSocket(122) with statsTag=0x2710, statsUid=-1
V/OneSignal(31114): OneSignalRestClient: After con.getResponseCode to: https://api.onesignal.com/apps/3b4b666a-d557-4b92-acdf-e2c8c4b95357/android_params.js?player_id=daf6c791-ef16-4e70-b675-52a2d8a27f3b
D/OneSignal(31114): OneSignalRestClient: GET - Using Cached response due to 304: {"awl_list":{},"android_sender_id":"159358117861","chnl_lst":[],"fba":true,"outcomes":{"direct":{"enabled":false},"indirect":{"notification_attribution":{"minutes_since_displayed":60,"limit":10},"enabled":false},"unattributed":{"enabled":false}},"receive_receipts_enable":false}
D/OneSignal(31114): OneSignal saveInfluenceParams: InfluenceParams{indirectNotificationAttributionWindow=60, notificationLimit=10, indirectIAMAttributionWindow=1440, iamLimit=10, directEnabled=false, indirectEnabled=false, unattributedEnabled=false}
D/OneSignal(31114): reassignDelayedInitParams with appContext: android.app.Application@2549f6
V/OneSignal(31114): setAppId called with id: 3b4b666a-d557-4b92-acdf-e2c8c4b95357 changing id from: null
V/OneSignal(31114): Starting OneSignal initialization!
V/OneSignal(31114): No class found, not setting up OSRemoteNotificationReceivedHandler
D/OneSignal(31114): OneSignal handleActivityLifecycleHandler inForeground: true
D/OneSignal(31114): Application foregrounded focus time: 29957259
E/AndroidRuntime(31114): FATAL EXCEPTION: OS_REST_SUCCESS_CALLBACK
E/AndroidRuntime(31114): Process: com.example.onesignal_v3_crash, PID: 31114
E/AndroidRuntime(31114): java.lang.NullPointerException: null receiver
E/AndroidRuntime(31114): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(31114): 	at com.onesignal.TrackAmazonPurchase.<init>(TrackAmazonPurchase.java:77)
E/AndroidRuntime(31114): 	at com.onesignal.OneSignal.handleAmazonPurchase(OneSignal.java:985)
E/AndroidRuntime(31114): 	at com.onesignal.OneSignal.init(OneSignal.java:863)
E/AndroidRuntime(31114): 	at com.onesignal.OneSignal.setAppId(OneSignal.java:736)
E/AndroidRuntime(31114): 	at com.onesignal.OneSignal.reassignDelayedInitParams(OneSignal.java:1181)
E/AndroidRuntime(31114): 	at com.onesignal.OneSignal.onRemoteParamSet(OneSignal.java:890)
E/AndroidRuntime(31114): 	at com.onesignal.OneSignal$7.complete(OneSignal.java:1122)
E/AndroidRuntime(31114): 	at com.onesignal.OneSignalRemoteParams.processJson(OneSignalRemoteParams.java:211)
E/AndroidRuntime(31114): 	at com.onesignal.OneSignalRemoteParams.access$100(OneSignalRemoteParams.java:12)
E/AndroidRuntime(31114): 	at com.onesignal.OneSignalRemoteParams$1.onSuccess(OneSignalRemoteParams.java:156)
E/AndroidRuntime(31114): 	at com.onesignal.OneSignalRestClient$5.run(OneSignalRestClient.java:284)
E/AndroidRuntime(31114): 	at java.lang.Thread.run(Thread.java:1012)
D/CompatibilityChangeReporter(31114): Compat change id reported: 194532703; UID 10164; state: ENABLED
I/Process (31114): Sending signal. PID: 31114 SIG: 9
Lost connection to device.

Exited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants