Android Question Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified

mkalarakis

New Member
With B4A, Xiaomi 12 phone Android 13 TKQ1221013.002 miui global 14.0.9
I get this error ......java.lang.IllegalArgumentException: b4a.example: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent....
when I run this line usb1.RequestPermission(i)
UsbSerial26 library version 2.50
manifest:
AddManifestText(
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="31"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
SetActivityAttribute(main, android:directBootAware, "true")
'End of default text.
AddActivityText(main, <intent-filter>
    <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
    <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
        android:resource="@xml/device_filter" />)


with Xiaomi 5 Redme   Android 7 there is no problem
Please give me a piece of advice
 

agraham

Expert
Licensed User
Longtime User
The library needs updating. I don't recognise a library called 'UsbSerial26' but my UsbSerial library version 2.5 has been updated to add the required flag.

 
Upvote 1
Top