• Setup an Android project with targetSdkVersion: 31
  • Include v4.2.1 of SF Chat Android SDK (latest available)
    implementation "com.salesforce.service:chat-ui::4.2.1"
  • Run the app and start a new chat -> the app crashes


Fatal Exception: java.lang.IllegalArgumentException: com.peaks.test: 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.salesforce.android.service.common.utilities.internal.android.IntentFactory.createActivityPendingIntent(IntentFactory.java:47)
       at com.salesforce.android.chat.ui.internal.notification.ChatNotificationManager$Builder.build(ChatNotificationManager.java:310)
       at com.salesforce.android.chat.ui.internal.client.InternalChatUIClient$Builder.build(InternalChatUIClient.java:594)
       at com.salesforce.android.chat.ui.ChatUI.createClient(ChatUI.java:80)

2 Answers 2


SalesForce has released a new version of the SDK that addresses this issue:

SDK v224.1.2 (Chat v4.2.2)

Fix: Allows customers to upgrade their targetVersion to API 31 (Android 12). Without these changes, customers would get build issues or crashes on Android 12 if their app targeted API 31 (Android 12).

implementation "com.salesforce.service:chat-ui::4.2.2"

Thanks for bringing this issue to our attention. We are currently working on a fix and will release it very soon.

.Lead Android Service SDK Engineer at Salesforce

  • 1
    Welcome to Salesforce Stack Exchange (SFSE)! I assume by you saying "our" and "we" that you are somehow affiliated with the SF Chat Android SDK? Just asking for clarification.
    – Moonpie
    Commented Oct 26, 2021 at 17:33
  • That's correct. Commented Oct 26, 2021 at 18:00
  • Thanks, Colin! Would you mind editing to add that information about your role to your post so that the community understands you're answering from a position of authority?
    – David Reed
    Commented Oct 26, 2021 at 18:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .