在 flutter 应用程序中,目标 S+(版本 31 及更高版本)要求在创建 PendingIntent 时指定 FLAG_IMMUTABLE 或 FLAG_MUTABLE 之一

2024-02-22

Please help me to sort out the problem. I give a link to the git. https://github.com/Vasajj/radio_tysa_fm.git https://github.com/Vasajj/radio_tysa_fm.git something is wrong with PendingIntent, with package:flutter_radio_player On android 8 all is fine

Installing build\app\outputs\flutter-apk\app.apk...
Debug service listening on ws://127.0.0.1:55138/iMdUmbZTaNc=/ws
Syncing files to device sdk gphone64 x86 64...
I/javaClass(18284): Calling to method: initService
I/javaClass(18284): start service invoked
I/javaClass(18284): Attempting to initialize service...
I/javaClass(18284): Service not bound, binding now....
I/javaClass(18284): Mapping method call to player item object
I/javaClass(18284): Firing up service. (onStartCommand)...
I/javaClass(18284): LocalBroadCastManager Received...
W/e.radio_tysa_f(18284): Accessing hidden method Landroid/media/AudioTrack;->getLatency()I (unsupported, reflection, allowed)
I/ExoPlayerImpl(18284): Init 398a550 [ExoPlayerLib/2.13.1] [emulator64_x86_64_arm64, sdk_gphone64_x86_64, Google, 32]
I/javaClass(18284): Pushing Event: flutter_radio_loading
I/javaClass(18284): onPlayerStateChanged: LOADING
D/AndroidRuntime(18284): Shutting down VM
E/AndroidRuntime(18284): FATAL EXCEPTION: main
E/AndroidRuntime(18284): Process: com.example.radio_tysa_fm, PID: 18284
E/AndroidRuntime(18284): java.lang.RuntimeException: Unable to start service me.sithiramunasinghe.flutter.flutter_radio_player.core.StreamingCore@ed87b05 with Intent { cmp=com.example.radio_tysa_fm/me.sithiramunasinghe.flutter.flutter_radio_player.core.StreamingCore (has extras) }: java.lang.IllegalArgumentException: com.example.radio_tysa_fm: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/AndroidRuntime(18284): 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(18284):    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4697)
E/AndroidRuntime(18284):    at android.app.ActivityThread.access$2000(ActivityThread.java:256)
E/AndroidRuntime(18284):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2128)
E/AndroidRuntime(18284):    at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(18284):    at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime(18284):    at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime(18284):    at android.app.ActivityThread.main(ActivityThread.java:7842)
E/AndroidRuntime(18284):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(18284):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/AndroidRuntime(18284):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E/AndroidRuntime(18284): Caused by: java.lang.IllegalArgumentException: com.example.radio_tysa_fm: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/AndroidRuntime(18284): 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(18284):    at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
E/AndroidRuntime(18284):    at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
E/AndroidRuntime(18284):    at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
E/AndroidRuntime(18284):    at com.google.android.exoplayer2.ui.PlayerNotificationManager.createBroadcastIntent(PlayerNotificationManager.java:1395)
E/AndroidRuntime(18284):    at com.google.android.exoplayer2.ui.PlayerNotificationManager.createPlaybackActions(PlayerNotificationManager.java:1351)
E/AndroidRuntime(18284):    at com.google.android.exoplayer2.ui.PlayerNotificationManager.<init>(PlayerNotificationManager.java:658)
E/AndroidRuntime(18284):    at com.google.android.exoplayer2.ui.PlayerNotificationManager.<init>(PlayerNotificationManager.java:568)
E/AndroidRuntime(18284):    at com.google.android.exoplayer2.ui.PlayerNotificationManager.createWithNotificationChannel(PlayerNotificationManager.java:521)
E/AndroidRuntime(18284):    at me.sithiramunasinghe.flutter.flutter_radio_player.core.StreamingCore.onStartCommand(StreamingCore.kt:248)
E/AndroidRuntime(18284):    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4679)
E/AndroidRuntime(18284):    ... 9 more
I/Process (18284): Sending signal. PID: 18284 SIG: 9
Lost connection to device.

如果您的错误消息还包含这些包androidx.work.impl.utils您的依赖项可能已过时且与 android 运行时 31 不兼容。

更新 androidx.work.work-runtime-ktx 依赖项以修复问题:

在应用程序.gradle中

implementation 'androidx.work:work-runtime-ktx:2.8.0-alpha01'

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 flutter 应用程序中,目标 S+(版本 31 及更高版本)要求在创建 PendingIntent 时指定 FLAG_IMMUTABLE 或 FLAG_MUTABLE 之一 的相关文章

随机推荐