【问题标题】:Flutter App targeting Android 12 CRASHES => FLAG_IMMUTABLE or FLAG_MUTABLE to be specified when creating a PendingIntentFlutter App 针对 Android 12 CRASHES => FLAG_IMMUTABLE 或 FLAG_MUTABLE 在创建 PendingIntent 时指定
【发布时间】:2022-01-04 07:42:46
【问题描述】:

我在 Flutter 中开发应用程序。有人会建议我在哪里更改 PendingIntent 以使用 FLAG_IMMUTABLE?应用程序安装在模拟器上,但在启动时崩溃。谁能举一个简短的例子在哪里改变它?

我读到 workmanager 2.7.1 可以帮助解决问题。具体应该添加到哪里?

【问题讨论】:

  • 如果对您有帮助,请考虑接受@SebastienB 的回答。我只是在此处删除此评论,以便其他搜索错误消息的人找到此线程。 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..

标签: android flutter mobile


【解决方案1】:

只需在 android/app/build.gradledependencies 部分添加 implementation 'androidx.work:work-runtime-ktx:2.7.0' 即可对我有用

这是该问题的建议解决方案:https://github.com/flutter/flutter/issues/93609

【讨论】:

    猜你喜欢
    • 2022-11-21
    • 2023-01-30
    • 2023-01-01
    • 1970-01-01
    • 2021-09-14
    • 1970-01-01
    • 2022-10-05
    • 2021-09-29
    • 2022-01-08
    相关资源
    最近更新 更多