安卓 12 崩溃。华为服务

标签 android huawei-mobile-services huawei-developers android-12

在我们的应用程序中,我们有依赖:com.huawei.hms:base:6.1.0.302并使用 HuaweiApiAvailability类(class)。
作为调用此函数的结果PendingIntent getErrPendingIntent(Context var1, ConnectionResult var2)我们有异常(exception):

Process: com...preview, PID: 10355
java.lang.IllegalArgumentException: com...preview: 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.huawei.hms.api.b.getErrPendingIntent(HuaweiApiAvailabilityImpl.java:10)
at com.huawei.hms.common.internal.BaseHmsClient.resolution(BaseHmsClient.java:3)
at com.huawei.hms.common.internal.BaseHmsClient.checkAvailabilityAndConnect(BaseHmsClient.java:34)
at com.huawei.hms.common.internal.BaseHmsClient.connect(BaseHmsClient.java:1)
at com.huawei.hms.common.internal.HuaweiApiManager$ConnectionManager.connect(HuaweiApiManager.java:21)
at com.huawei.hms.common.internal.HuaweiApiManager$ConnectionManager.sendRequest(HuaweiApiManager.java:24)
at com.huawei.hms.common.internal.HuaweiApiManager.connectAndSendRequest(HuaweiApiManager.java:8)
at com.huawei.hms.common.internal.HuaweiApiManager.handleMessage(HuaweiApiManager.java:7)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
问题:您是否打算使用 Android 12 的新标志更新 PendingIntens?

最佳答案

更新
新版基础SDK已经发布:implementation 'com.huawei.hms:base:6.2.0.300'此问题已修复,您可以先显式依赖此版本的 base sdk,这应该可以解决问题。

感谢您的反馈,研发团队确认将于9月底发布固定版本。
届时请使用最新版本进行测试。谢谢。

关于安卓 12 崩溃。华为服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69225285/

相关文章:

huawei-mobile-services - 华为移动服务推送套件 907122036 : no right API call

react-native - Huawei Map Kit React Native 不渲染 map

java - Android中如何在不锁定UI线程的情况下等待?

android - Android Studio 中使用 kotlin 的未解决引用 currentThread().wait()

android - 为什么华为推送应用发布后不起作用?

android - HMS+GMS 设备上的 HMS 推送通知问题

android - 将 JSON 数据检索到 ListView 中

android - 通过蓝牙将字符串发送到 Arduino 上的 Android 设备

huawei-mobile-services - 无法为华为 map 服务生成签名证书 sha 256

huawei-mobile-services - 如何在Android Studio Bumblebee (2021.1.1) Patch 1)中集成HMS Kit?