Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Targeting S+ (version 10000 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. #1050

Open
Luducrous opened this issue Nov 14, 2023 · 0 comments

Comments

@Luducrous
Copy link

Documented behaviour

java.lang.RuntimeException: Unable to create service com.ryanheise.audioservice.AudioService: java.lang.IllegalArgumentException: com.ryanheise.audioserviceexample: Targeting S+ (version 10000 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/AndroidRuntime(17914): 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.

Actual behaviour

The app quit instead of launching on the device.

Runtime error

E/AndroidRuntime(17914): FATAL EXCEPTION: main
E/AndroidRuntime(17914): Process: com.ryanheise.audioserviceexample, PID: 17914
E/AndroidRuntime(17914): java.lang.RuntimeException: Unable to create service com.ryanheise.audioservice.AudioService: java.lang.IllegalArgumentException: com.ryanheise.audioserviceexample: Targeting S+ (version 10000 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/AndroidRuntime(17914): 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(17914): 	at android.app.ActivityThread.handleCreateService(ActivityThread.java:4387)
E/AndroidRuntime(17914): 	at android.app.ActivityThread.access$1600(ActivityThread.java:250)
E/AndroidRuntime(17914): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2004)
E/AndroidRuntime(17914): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(17914): 	at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime(17914): 	at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime(17914): 	at android.app.ActivityThread.main(ActivityThread.java:7858)
E/AndroidRuntime(17914): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(17914): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/AndroidRuntime(17914): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:984)
E/AndroidRuntime(17914): Caused by: java.lang.IllegalArgumentException: com.ryanheise.audioserviceexample: Targeting S+ (version 10000 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/AndroidRuntime(17914): 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(17914): 	at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
E/AndroidRuntime(17914): 	at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:648)
E/AndroidRuntime(17914): 	at android.app.PendingIntent.getBroadcast(PendingIntent.java:634)
E/AndroidRuntime(17914): 	at android.support.v4.media.session.MediaSessionCompat.<init>(MediaSessionCompat.java:559)
E/AndroidRuntime(17914): 	at android.support.v4.media.session.MediaSessionCompat.<init>(MediaSessionCompat.java:530)
E/AndroidRuntime(17914): 	at android.support.v4.media.session.MediaSessionCompat.<init>(MediaSessionCompat.java:494)
E/AndroidRuntime(17914): 	at android.support.v4.media.session.MediaSessionCompat.<init>(MediaSessionCompat.java:468)
E/AndroidRuntime(17914): 	at com.ryanheise.audioservice.AudioService.onCreate(AudioService.java:312)
E/AndroidRuntime(17914): 	at android.app.ActivityThread.handleCreateService(ActivityThread.java:4374)
E/AndroidRuntime(17914): 	... 9 more
Error connecting to the service protocol: failed to connect to http://127.0.0.1:56626/bbP1xgCPmPM=/
Exited

Minimal reproduction project

Official example: main.dart

Reproduction steps

  1. The app does not launch at all.

Output of flutter doctor

[✓] Flutter (Channel stable, 3.13.9, on macOS 14.0 23A344 darwin-arm64, locale en-NL)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.84.2)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!```
### Devices exhibiting the bug
Pixel 4 API S
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant