OneSignal / OneSignal-Android-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native Android or Amazon app with OneSignal. https://onesignal.com
Other
591 stars 368 forks source link

[Bug]: Getting crash on internal SDK function #2086

Closed hsaddique closed 1 month ago

hsaddique commented 1 month ago

What happened?

Getting following error after upgrading the SDK to 5.1.12:

Fatal Exception: java.lang.IndexOutOfBoundsException: Index: 4, Size: 2 at java.util.ArrayList.add(ArrayList.java:483) at com.onesignal.core.internal.operations.impl.OperationRepo.internalEnqueue(OperationRepo.kt:154) at com.onesignal.core.internal.operations.impl.OperationRepo.loadSavedOperations$com_onesignal_core(OperationRepo.kt:414) at com.onesignal.core.internal.operations.impl.OperationRepo$start$1.invokeSuspend(OperationRepo.kt:112) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919)

Steps to reproduce?

Don't know.

What did you expect to happen?

Should not crash, maybe put try/catch on the error

OneSignal Android SDK version

5.1.12

Android version

13, 12, 11, 10, 9

Specific Android models

Galaxy M04
Galaxy Note10+
Galaxy A21s

Huawei Y9 2019
Y7 Prime 2019
AQM-LX1

Relevant log output

Fatal Exception: java.lang.IndexOutOfBoundsException: Index: 4, Size: 2
       at java.util.ArrayList.add(ArrayList.java:483)
       at com.onesignal.core.internal.operations.impl.OperationRepo.internalEnqueue(OperationRepo.kt:154)
       at com.onesignal.core.internal.operations.impl.OperationRepo.loadSavedOperations$com_onesignal_core(OperationRepo.kt:414)
       at com.onesignal.core.internal.operations.impl.OperationRepo$start$1.invokeSuspend(OperationRepo.kt:112)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:919)

Code of Conduct

jinliu9508 commented 1 month ago

Hi @hsaddique, thank you for reporting this issue. The stack trace suggests that you are using SDK version 5.1.11 instead of 5.1.12, and this issue is specific to 5.1.11. Could you upgrade to 5.1.12 and see if it occurs again?

hsaddique commented 1 month ago

Hi @jinliu9508, according to my dependency tree for android, the SDK version is 5.1.12

Screenshot 2024-05-14 at 3 58 26 PM
jkasten2 commented 1 month ago

@hsaddique if you built your app with the latest SDK on May 7th it would have grabbed 5.1.11. The next day 5.1.12 was released. I can confirm your stack trace is from 5.11.1, so you may have built your app that day on that version and shipped it.

Based on your screenshot it looks you confirmed you are now building your app with 5.1.12, so I would recommend shipping an app update to resolve the issue.