Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crash Executing Android APP targeting API 31 with Huawei HMS Base 6.1.0.302 on Android 12

I have updated my application for target API 31 and now i am having crashes in runtime when executing only in phones with Android 12. The crash is:

E/AndroidRuntime: FATAL EXCEPTION: HuaweiApiManager
    Process: com.example.myapp, PID: 4873
    java.lang.IllegalArgumentException: com.example.myapp: 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)
        at android.os.HandlerThread.run(HandlerThread.java:67)

This error is related with When will Push Kit include the android:exported attributes required for Android 12?

What is the approximate release date for the version of HMS Base that fix this error?

like image 736
Antonio Aponte Avatar asked Nov 15 '22 18:11

Antonio Aponte


1 Answers

A new version of the base SDK has been released :

implementation 'com.huawei.hms:base:6.2.0.300'

This issue has been fixed, you can explicitly depend on this version of base sdk first, which should fix the problem.

like image 171
zhangxaochen Avatar answered Dec 28 '22 21:12

zhangxaochen