Status Update
Comments
os...@gmail.com <os...@gmail.com> #2
I experienced the same bug by using an emulator running Android V12, Api level 31. The bug happened even when no pending intent was used for notification or when the Work component was not called.
Adding the flag FLAG_IMMUTABLE to the pendingIntent did not help.
I was running "androidx.work:work-runtime:2.7.0-alpha04".
sv...@gmail.com <sv...@gmail.com> #3
As temporary workaround - comment out including "work" dependency in gradle and remove using that class through the project. At least in this way you may run app normally and work on another features and areas....
ra...@google.com <ra...@google.com> #4
There was a bug in the platform that got fixed recently which causes this.
Let me investigate if the fix actually landed in beta03.
ne...@gmail.com <ne...@gmail.com> #6
zh...@zte.com.cn <zh...@zte.com.cn> #7
see the source code of workManaher .In the file ForceStopRunnable.java ,a pendingintent is created,but not to set flag_mutable or flag_immutable。In behavior changes of Android S, require pendingintent must set to be mutable or immutable.
the link ;
the source code:
line 15:8:PendingIntent pendingIntent = getPendingIntent(mContext, FLAG_NO_CREATE);
.....
line:283:private static PendingIntent getPendingIntent(Context context, int flags) {
Iline:284: ntent intent = getIntent(context);
line:285: return PendingIntent.getBroadcast(context, ALARM_ID, intent, flags);
os...@gmail.com <os...@gmail.com> #8
Thank you for quick resolving this issue.
da...@gmail.com <da...@gmail.com> #9
sh...@gmail.com <sh...@gmail.com> #10
after adding this
implementation "com.google.android.gms:play-services-ads:20.4.0"
app is crashing on startup with exception
Process: com.basebone.download_now, PID: 14467
java.lang.IllegalArgumentException: com.basebone.download_now: 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:174)
at androidx.work.impl.utils.ForceStopRunnable.isForceStopped(ForceStopRunnable.java:108)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:86)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:75)
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)
compileSdk 31
minSdk 23
targetSdk 31
versionCode 1
ra...@google.com <ra...@google.com> #11
You are using WorkManager
because it is getting pulled in as a transitive dependency. Use version 2.7.x
instead.
pa...@outlook.com <pa...@outlook.com> #12
posting here because I have no freaking idea where to put since these "components" are stupid confusing, we never know exactly where to open an issue for a specific problem, and the "help" that was provided was as useful as a doormat made of toilet paper. I am so tired of these Android shenanigans to the point of considering giving up on reporting bugs entirely.
se...@google.com <se...@google.com> #13
Workmanager has 2.7.0
has correct dependency on androidx.core, so I'm closing this as fixed.
Here is snippet how to use FLAG_MUTABLE
behind buildcompat check:
Description
Version used: **2.7.0-alpha04**
Devices/Android versions reproduced on: **Android S Beta3/Emulator**
Device: Pixel 3a
targetSdkVersion: 31
compileSdkVersion: 31
On the 'App launch' retrieved the crash (everywhere in the app applied FLAG_IMMUTABLE or FLAG_MUTABLE to the using PendingIntents):
java.lang.IllegalArgumentException:
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:367)
at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:640)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:626)
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)
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)
I have updated all PendingIntents in my App with the mutability flags.
As seen before the same issue was fixed in version 2.7.0-alpha02 but after updating the targetSdkVersion to 31, this is still reproducing in 2.7.0-alpha04
Thanks,
Neha