urbanairship / airship-flutter

Flutter integration
Other
17 stars 16 forks source link

[Android SDK 31] Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. #95

Closed lore-co closed 2 years ago

lore-co commented 3 years ago

Preliminary Info

What Airship dependencies are you using?

airship_flutter: ^4.4.0

What are the versions of any relevant development tools you are using?

Android Studio Arctic Fox

Report

What unexpected behavior are you seeing?

When migrating the app to Android target SDK 31, the following error generate a runtime Crash when starting the application.

java.lang.IllegalArgumentException: package-name-here: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. E/AndroidRuntime(25087): 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. E/AndroidRuntime(25087): at android.app.PendingIntent.checkFlags(PendingIntent.java:375) E/AndroidRuntime(25087): at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645) E/AndroidRuntime(25087): at android.app.PendingIntent.getBroadcast(PendingIntent.java:632) E/AndroidRuntime(25087): at androidx.work.impl.utils.ForceStopRunnable.getPendingIntent(ForceStopRunnable.java:273) E/AndroidRuntime(25087): at androidx.work.impl.utils.ForceStopRunnable.isForceStopped(ForceStopRunnable.java:151) E/AndroidRuntime(25087): at androidx.work.impl.utils.ForceStopRunnable.forceStopRunnable(ForceStopRunnable.java:171) E/AndroidRuntime(25087): at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:102) E/AndroidRuntime(25087): at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91) E/AndroidRuntime(25087): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) E/AndroidRuntime(25087): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) E/AndroidRuntime(25087): at java.lang.Thread.run(Thread.java:920)

What is the expected behavior?

Not experiencing the crash and be able to safely publish it with SDK 31.

What are the steps to reproduce the unexpected behavior?

-> use SDK 31 as target SDK -> run application on an Android device

Do you have logging for the issue?

rlepinski commented 3 years ago

This PR should be ready this week that will move the Android SDK to a version with the mutable/immutable flags, however we are still waiting on workmanager to release an Android S compatible version.

Its possible to just override the airship versions and workmanager version in your build.gradle if you need it sooner.

rlepinski commented 2 years ago

Should be fixed in 5.1.0