๐ [BUG/ERROR]: [Admob:20.4.0] Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE
Closed this issue ยท 2 comments
mahdi-malv commented
Describe the issue:
App crashes on Android 12 when targetSDK=31
Paste the error text in your logs:
java.lang.IllegalArgumentException: ir.tapsell.plussample.android: 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: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)
How to reproduce this issue:
- TargetSDK = 31 or higher
- Admob library: 20.4.0
- Test on
Android 12
device
App package name: irrelevant
mahdi-malv commented
Quick solution: Update admob to 20.5.0
Current workaround (Admob 20.4.0
and prior):
Issue occurs because of workmanager
. Just override it and use 2.7.1
implementation("androidx.work:work-runtime:2.7.1")
Issue will be closed after a shipped fix
(Read more: https://developers.google.com/admob/android/rel-notes)
mahdi-malv commented
2.1.7
contains updated dependencies and a fix for this. Closing this.