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]: Crash java.lang.NullPointerException - println needs a message #1577

Open
2 of 3 tasks
Chasty opened this issue Oct 2, 2023 · 2 comments
Open
2 of 3 tasks

Comments

@Chasty
Copy link

Chasty commented Oct 2, 2023

What happened?

Crashlytics are reporting this issue.

RNOneSignal.preventDefault

com.onesignal.rnonesignalandroid
RNOneSignal.java:392

Steps to reproduce?

-

What did you expect to happen?

React Native OneSignal SDK version

5.0.0

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

Fatal Exception: java.lang.NullPointerException: println needs a message
       at android.util.Log.println_native(Log.java)
       at android.util.Log.e(Log.java:255)
       at com.onesignal.rnonesignalandroid.RNOneSignal.preventDefault(RNOneSignal.java:392)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
       at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
       at com.facebook.jni.NativeRunnable.run(NativeRunnable.java)
       at android.os.Handler.handleCallback(Handler.java:942)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
       at android.os.Looper.loopOnce(Looper.java:201)
       at android.os.Looper.loop(Looper.java:288)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
       at java.lang.Thread.run(Thread.java:1012)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Chasty Chasty changed the title [Bug]: java.lang.NullPointerException - println needs a message [Bug]: Crash java.lang.NullPointerException - println needs a message Oct 2, 2023
@Sondago
Copy link

Sondago commented Nov 2, 2023

Hi, same here !

@VirtualDOMinic
Copy link

Same reported on Sentry as a fatal crash:

react-native-onesignal version 5.0.5 on a Samsung Galaxy S22+ (SM-S906B) on Android 14.

java.lang.NullPointerException: println needs a message
    at android.util.Log.println_native(Log.java)
    at android.util.Log.e(Log.java:347)
    at com.onesignal.rnonesignalandroid.RNOneSignal.displayNotification(RNOneSignal.java:387)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
    at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
    at com.facebook.jni.NativeRunnable.run(NativeRunnable.java)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
    at android.os.Looper.loopOnce(Looper.java:230)
    at android.os.Looper.loop(Looper.java:319)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
    at java.lang.Thread.run(Thread.java:1012)

Relevant code has no preventDefault explicitly called (and nothing directly related to onesignal done in receiveInAppPushNotification), but does have some related weirdness explained in the code comment:

  OneSignal.Notifications.addEventListener('foregroundWillDisplay', event => {
    store.dispatch(receiveInAppPushNotification(event.notification));

    /**
     * Notifs not visible when app foregrounded unless we call `display()` manually here, even though no `preventDefault()`
     * https://documentation.onesignal.com/docs/mobile-sdk#handle-notifications-before-displayed-when-the-app-is-in-the-foreground
     * Could also call `display()` somewhere in `receiveInAppPushNotification` fn, but here seems clearer
     */
    event.notification.display();
  });

@Chasty and @Sondago have you found a fix? E.g. is the latest minor version of OneSignal without this error?

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

3 participants