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

Application crashes due to one signal when run on Android 12 device #1310

Closed
dbilgin opened this issue Nov 1, 2021 · 10 comments
Closed

Application crashes due to one signal when run on Android 12 device #1310

dbilgin opened this issue Nov 1, 2021 · 10 comments

Comments

@dbilgin
Copy link

dbilgin commented Nov 1, 2021

Description:

Android 12 recently made it mandatory to use FLAG_IMMUTABLE or FLAG_MUTABLE, this makes the application crash as soon as it's opened.

Environment

react-native-onesignal version: 4.3.1
added to the project with yarn

Steps to Reproduce Issue:

  1. Install one signal
  2. Initialise onesignal in react native
  3. Run the app on an Android 12 device

Anything else:

(crash stacktraces, as well as any other information here)

Process: , PID: 19559
    java.lang.IllegalArgumentException: : Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
    Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
        at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
        at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
        at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
        at androidx.work.impl.utils.ForceStopRunnable.getPendingIntent(ForceStopRunnable.java:273)
        at androidx.work.impl.utils.ForceStopRunnable.isForceStopped(ForceStopRunnable.java:151)
        at androidx.work.impl.utils.ForceStopRunnable.forceStopRunnable(ForceStopRunnable.java:171)
        at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:102)
        at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
@rgomezp
Copy link
Contributor

rgomezp commented Nov 3, 2021

Howdy,
I'm not seeing OneSignal anywhere in the stack trace. Can you please include more of the log or perhaps explain a bit more why you think this is a OneSignal-related issue?

Cheers

@dbilgin
Copy link
Author

dbilgin commented Nov 3, 2021

@rgomezp thanks for your reply, well I don't call PendingIntent anywhere on the native side and it works fine when I remove only the onesignal sdk from package.json

@rgomezp
Copy link
Contributor

rgomezp commented Nov 3, 2021

What device are you running this on?

@dbilgin
Copy link
Author

dbilgin commented Nov 3, 2021

I've tried running it on an emulator with Android 12 installed and my Pixel 5 which also has Android 12 installed. It works fine for anything below Android 12 so far.
One more thing I realised recently, I tried creating a pure Android project and adding your native Android sdk there and I faced the same issue. It crashes on application start.

@nan-li
Copy link
Contributor

nan-li commented Nov 4, 2021

Stack trace is same as OneSignal/OneSignal-Android-SDK#1442.
The fix is merged but not released yet.

In the meantime you can use this version in your app by simply adding it to your app/build.gradle.

api 'androidx.work:work-runtime:2.7.0-rc01'

@dbilgin
Copy link
Author

dbilgin commented Nov 4, 2021

Thanks @nan-li! I guess I can close this then. The temporary fix seems to work as well.

@dbilgin dbilgin closed this as completed Nov 4, 2021
@dbilgin
Copy link
Author

dbilgin commented Nov 10, 2021

Hi again @rgomezp, this issue seems to still be there with version 4.3.1 even though there has been a release on the android sdk if I am not mistaken.

@dbilgin
Copy link
Author

dbilgin commented Nov 10, 2021

Created a PR for this here. Seems to resolve it for me at least.

@jkasten2
Copy link
Member

@dbilgin This is now fixed in the 4.3.2 release

@kdqtech
Copy link

kdqtech commented Dec 7, 2022

HI team , I have followed this all the steps but still this is not resolved for me with latest library version

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

No branches or pull requests

5 participants