Runtime Error: Targeting S+ (version 31 and above) requires that one flag of FLAG_IMMUTABLE be specified[...]

Anyone have any idea what I'm doing wrong here?

I'm trying to make a super simple app for myself that sends a text based on data it pulls from a Google Spreadsheet. Everything works except for actually sending the text. No matter what I do, I always get this message:


I even made an app that literally just sends a pre-written text to a pre-defined phone number, and nothing else. Even this gives me the same issue:


This problem occurs on my Pixel 6 Pro and my S21 Ultra, both running Android 12.

I am very new to this so please excuse my ignorance if I have missed something incredibly simple. Someone please help. Thanks!

You're not doing anything wrong. This appears to be a bug in the latest version that we will need to squash. Thanks for reporting it.

Edit: Now tracking this issue on GitHub.

Ah okay. Thanks for the quick reply!

Any idea what kind of timeline we're looking at for this fix? Not to be impatient - just asking.

I'm fairly certain the fix is a one line change on our end, but I also wonder what other components might be affected by the same bug. Therefore I want to review all of our uses of Android's PendingIntent which will take some time.

1 Like

So it looks like the Texting component is the only one affected by this. I've put together a potential fix but we'll need to test it before merging.

See also here:

Not really. I get the identical message on Android12 whilst using an extension (Servico) which does not occur on Android 8 - 11. The issue could be something in the extension of course.

I have had to code around on several issues on a few apps that compiled fine on Android 11 that have issues w.r.t. Text file components. Using a different Text tool 'fixed the issue'. Wish I had taken better notes.

Since I don't have sources for extensions I can't speak to extensions. My statement was only with respect to the App Inventor code base. Any extensions that use PendingIntent will need to make sure that they assert whether the PendingIntent is mutable or not to satisfy this new Android 12 constraint.

1 Like

Even Serial is having this problem. See this

The error occurs when the call Serial1.OpenSerial block is executed.

...note that you can't distribute your App via Google Play if you use SendMessageDirect. Android Security measures require your App to send via the default Device messenger App.

Thank you for the heads up. This is just for me. I have no plans for distribution


2 posts were split to a new topic: Sending Group texts

SendMessageDirect en Android 12

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.

@QBoxIT00 Please see post # 4

No habia visto este tema, tengo la misma problematica, pero es especificamente con las extensiones NotificationStyle y ItoO, porque al eliminar dichas extensiones la apliacion deja de enviar este error, hice una pequeña app de prueba y si es por las extensiones

The kio4.service.aix extension also had problems with FLAG_IMMUTABLE or FLAG_MUTABLE, I have updated it, I hope it works.

I have deployed a temporary server where you can test the issues related to FLAG_IMMUTABLE in the built-in components here. Extension authors will still need to separately update their extensions to be compatible with Android S.


Thanks for the efforts. I am making a simple SMS based app to act as a paging app. I uploaded my .aia file to nb190a-bugfixes.ai2-ewpatton... server but I am getting the same Targeting S+ version 31 and above)... error. The version of emulator I am using is 2.65u

I attaching the .aia file here for reference.
KayKayPagingReceiver.aia (719.6 KB)

MIT knows about the bug in the SMS component since nb190 and Companion 2.65.

The Texting component will be fixed soon. Please be patient. :slight_smile:


Did you install the companion version provided by that server? It should be 2.65d1u. Otherwise, you have the production companion which will still have the bug.