optimizely / android-sdk

Android SDK for Optimizely Feature Experimentation and Optimizely Full Stack (legacy)
https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/android-sdk
Apache License 2.0
55 stars 39 forks source link

Issues targeting android 12 (API 31) #405

Closed jia-tse-zocdoc closed 2 years ago

jia-tse-zocdoc commented 2 years ago

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)
jaeopt commented 2 years ago

@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.

jia-tse-zocdoc commented 2 years ago

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.

jaeopt commented 2 years ago

@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'"?

jia-tse-zocdoc commented 2 years ago

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

jaeopt commented 2 years ago

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