Cocos2d-x game crash in Android targetSdkVersion 31

hi developers, is there any idea on these crashes please help me to resolve these two crashes. need your help please help me.
1)
java.lang.IllegalArgumentException:
at android.app.PendingIntent.checkFlags (PendingIntent.java:382)
at android.app.PendingIntent.getBroadcastAsUser (PendingIntent.java:673)
at android.app.PendingIntent.getBroadcast (PendingIntent.java:660)
at androidx.work.impl.utils.ForceStopRunnable.getPendingIntent (ForceStopRunnable.java:5)
at androidx.work.impl.utils.ForceStopRunnable.isForceStopped (ForceStopRunnable.java:4)
at androidx.work.impl.utils.ForceStopRunnable.run (ForceStopRunnable.java:50)
at androidx.work.impl.utils.SerialExecutor$Task.run (SerialExecutor.java:2)
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:920)

exception.class.missing.Unknown

exception.class.missing.Unknown: 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:382)
at android.app.PendingIntent.getBroadcastAsUser (PendingIntent.java:673)
at android.app.PendingIntent.getBroadcast (PendingIntent.java:660)
at androidx.work.impl.utils.ForceStopRunnable.getPendingIntent (ForceStopRunnable.java:5)
at androidx.work.impl.utils.ForceStopRunnable.isForceStopped (ForceStopRunnable.java:4)
at androidx.work.impl.utils.ForceStopRunnable.run (ForceStopRunnable.java:50)
at androidx.work.impl.utils.SerialExecutor$Task.run (SerialExecutor.java:2)
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:920)

Fatal Exception: java.lang.IllegalArgumentException: com.companyname.gamename: 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:382)
at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:673)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:660)
at androidx.work.impl.utils.ForceStopRunnable.getPendingIntent(ForceStopRunnable.java:5)
at androidx.work.impl.utils.ForceStopRunnable.isForceStopped(ForceStopRunnable.java:4)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:50)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:2)
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:920)

anyone have an idea ?? kindly please help me to get solution. @CocosMarketing

The solution, as outlined here, is to add a dependency to your build.gradle file for Android 12 builds:

implementation 'androidx.work:work-runtime:2.7.1'

@stark2022 thanks you it’s perfectly worked. and i have found it earlier. but you responded me so Please accept my deepest gratitude…

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.