-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
Description
There is a behavior change in Android 12 which requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent if the app is targeting Android 12.
Current stable version (2.5.0) of WorkManager don’t have these flags, and so it affects all apps directly, or indirectly using WorkManager.
Apps will throw the following exception in runtime
Fatal Exception: java.lang.IllegalArgumentException: com.sample.packagename: Targeting S+ (version 10000 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:386) at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:657) at android.app.PendingIntent.getBroadcast(PendingIntent.java:644) 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)
Developer could manually adding the a compatible version of WorkManager (e.g. 2.7.0-alpha04) in their build.gradle file as workaround
implementation 'com.google.android.exoplayer:extension-workmanager:2.X.X'
// For apps targeting Android 12, add the following
constraints {
implementation 'androidx.work:work-runtime:2.7.0-alpha04'
}
Issue is on current version of ExoPlayer WorkManager Extension (2.14.1)
Reactions are currently unavailable