开发者社区> 问答> 正文

EMAS云升级,我们的APK(target 33),接入云升级 安装的时候 报错了

EMAS云升级,我们的APK(target 33),接入云升级 安装的时候 报错了 FATAL EXCEPTION: main Process: com.boomlink.machine, PID: 10735 java.lang.IllegalArgumentException: com.boomlink.machine: 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.getActivityAsUser(PendingIntent.java:458) at android.app.PendingIntent.getActivity(PendingIntent.java:444) at android.app.PendingIntent.getActivity(PendingIntent.java:408) at com.taobao.update.common.b.a.e$a.b(Taobao:59) at com.taobao.update.common.b.a.e.notifyDownloadFinish(Taobao:2) at com.taobao.update.apk.d.a$d.run(Taobao:1) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:210) at android.os.Looper.loop(Looper.java:299) at android.app.ActivityThread.main(ActivityThread.java:8103) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)?

展开
收起
cuicuicuic 2023-04-18 22:42:12 197 1
2 条回答
写回答
取消 提交回答
  • 阿里云sdk的bug,没适配新版本android,得等阿里云更新sdk了。
    android 12出来这么久了阿里云还没适配,也确实是坑。

    2023-12-28 07:46:58
    赞同 展开评论 打赏
  • 这个错误是由于在目标版本(targetSdkVersion)设置为33(Android 12及以上版本)的情况下,创建 PendingIntent 时未指定必要的标志(Flags)导致的。从Android S(版本31)开始,要求在创建 PendingIntent 时必须指定 FLAG_IMMUTABLE 或 FLAG_MUTABLE 之一,以确保 PendingIntent 的可变性。

    在你的情况下,你可以按照错误信息中的建议,使用 FLAG_IMMUTABLE 或 FLAG_MUTABLE 中的一个来修复这个问题。具体的解决方法取决于你创建 PendingIntent 的代码逻辑和需求。

    使用 FLAG_IMMUTABLE: 如果你的 PendingIntent 不需要被修改或更新,推荐使用 FLAG_IMMUTABLE。这会将 PendingIntent 设置为不可变,提高应用的安全性和性能。

    2023-07-27 21:12:13
    赞同 展开评论 打赏
来源圈子
更多
收录在圈子:
基于阿里巴巴以及合作伙伴的最佳实践,围绕大前端、云原生领域的相关技术热点(小程序、Serverless、应用中间件、低代码、DevOps)展开行业探讨,与开发者一起探寻云原生时代应用研发的新范式。
相关文档: 移动研发平台
问答排行榜
最热
最新

相关电子书

更多
五天玩转EMAS Serverless 立即下载
EMAS平台全景介绍 立即下载
从加固讲APK瘦身 立即下载