lazexe
lazexe

Reputation: 369

CRASH on Android 12 while using Huawei app service dependency, with build tools 31

We have implementation of

"com.huawei.hms:appservice:$huaweiAppService" WHERE huaweiAppService = '6.1.0.301'

And there is a crash:

java.lang.IllegalArgumentException: 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)

I noticed that some Huawei services already have updates related with issue. So I'm asking about appservice.

Upvotes: 3

Views: 578

Answers (2)

lazexe
lazexe

Reputation: 369

Problem temporary solved by adding huaweiBase transition dependency along with appService dependency.

It's updated some source of appServiceLibrary under the hood and it's looks like temporary fix. In near future I will remove this base dependency and just updated appService to newer.

huaweiBase = '6.2.0.300'
huaweiAppService = '6.1.0.301'

huaweiDependencies = [
      huaweiBase: "com.huawei.hms:base:$huaweiBase",
      appService: "com.huawei.hms:appservice:$huaweiAppService"
]

    
implementation huaweiDependencies.huaweiBase
implementation huaweiDependencies.appService

Upvotes: 1

zhangxaochen
zhangxaochen

Reputation: 34047

Thank you for your feedback, this issue is a known issue. The R&D team will release a new fixed version in mid-November, and I'll update this answer and let you know when it's released.

Upvotes: 1

Related Questions