Open TheMeanCanEHdian opened 2 months ago
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!
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: https://github.com/OneSignal/OneSignal-Android-SDK/issues/2178
@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.
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?
What did you expect to happen?
I expect OneSignal to initialize successfully
OneSignal Flutter SDK version
3.4.3
Which platform(s) are affected?
Relevant log output
Code of Conduct