optimizely/android-sdk

Issues targeting android 12 (API 31)

Closed this issue · 5 comments

Hi, I'm getting this error on app launch, and this only happens when I'm targeting 31 and using one of the more recent releases. When I downgraded back to the previous version (3.8.0), there were no errors.

    java.lang.IllegalArgumentException: com.zocdoc.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: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)
        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)

@jia-tse-zocdoc Thanks for reporting. This is due to a breaking change in Android 12.
Our SDK fix to support Android 12 target will be released this week.

Hi @jaeopt , just wanted to follow up on this. I don't see a new release addressing this issue yet. The latest release is causing these crashes for our users.

@jia-tse-zocdoc we've been working on the fix for android-12 (PR-400), but it's not included in the last release yet. As a workaround, have you tried overriding with "implementation 'androidx.work:work-runtime:2.7.1'"?

@jaeopt - thanks for the workaround, that did the trick.

@jia-tse-zocdoc We released 3.13.2, which includes the fix to support Android 12 (target SDK 31+).