OneSignal / react-native-onesignal

React Native Library for OneSignal Push Notifications Service
Other
1.57k stars 374 forks source link

[Bug]: NullPointerException - Unable to stop activity #1748

Open mannoeu opened 1 month ago

mannoeu commented 1 month ago

What happened?

App crashes on android devices. iOS works fine.

Device: Samsumg Galaxy A10s (SM-A107M)
Android Version: 10
Free Memory: 502.1 MB
Free Disk: 4.4 GB

Versions

react-native: 0.73.4
react-native-onesignal: 5.1.3

Steps to reproduce?

I don't know how to reproduce. When I use the emulator or check using a signed apk via Browserstack nothing is reported.

What did you expect to happen?

It shouldn't cause error or work.

React Native OneSignal SDK version

react-native-onesignal version 5.1.3 use SDK version 5

Which platform(s) are affected?

Relevant log output

java.lang.RuntimeException: Unable to stop activity {com.closeer.closeer_worker/com.closeer_worker.MainActivity}: java.lang.NullPointerException
        at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:5002)
        at android.app.ActivityThread.handleSleeping(ActivityThread.java:5131)
        at android.app.ActivityThread.access$2700(ActivityThread.java:272)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2153)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:8019)
        at java.lang.reflect.Method.invoke(Method.java:-2)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)

Caused by: java.lang.NullPointerException
        at com.onesignal.session.internal.session.impl.SessionService.getScheduleBackgroundRunIn(SessionService.kt:43)
        at com.onesignal.core.internal.background.impl.BackgroundManager.scheduleBackground(BackgroundManager.kt:95)
        at com.onesignal.core.internal.background.impl.BackgroundManager.onUnfocused(BackgroundManager.kt:87)
        at com.onesignal.core.internal.application.impl.ApplicationService$handleLostFocus$1.invoke(ApplicationService.kt:377)
        at com.onesignal.core.internal.application.impl.ApplicationService$handleLostFocus$1.invoke(ApplicationService.kt:377)
        at com.onesignal.common.events.EventProducer.fire(EventProducer.kt:50)
        at com.onesignal.core.internal.application.impl.ApplicationService.handleLostFocus(ApplicationService.kt:377)
        at com.onesignal.core.internal.application.impl.ApplicationService.onActivityStopped(ApplicationService.kt:198)
        at android.app.Application.dispatchActivityStopped(Application.java:515)
        at android.app.Activity.dispatchActivityStopped(Activity.java:1357)
        at android.app.Activity.onStop(Activity.java:2499)
        at androidx.fragment.app.FragmentActivity.onStop(FragmentActivity.java:520)
        at androidx.appcompat.app.AppCompatActivity.onStop(AppCompatActivity.java:257)
        at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1474)
        at android.app.Activity.performStop(Activity.java:8189)
        at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:4994)
        at android.app.ActivityThread.handleSleeping(ActivityThread.java:5131)
        at android.app.ActivityThread.access$2700(ActivityThread.java:272)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2153)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:8019)
        at java.lang.reflect.Method.invoke(Method.java:-2)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
mauripavan commented 1 week ago

@mannoeu Hi, having same issue captured by Sentry. Any updates?

react-native: 0.73.3 react-native-onesignal: 5.2.2