Updated 27 October 2023
Hi, today we will check one of the most common gradle issues with Flag Immutable and Flag Mutable In Flutter.
You will see the below error statement on your console:-
ava.lang.IllegalArgumentException: bundleId: Targeting S+ (version 31 and above) requires that one of Flag Immutable and Flag Mutable be specified when creating a PendingIntent.
W/System.err( 9990): 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.
This is the flutter gradle issue and can pop on many occasions. Some common occasions are when you try to perform some task like notification on the device with API level 31 or above. i.e. Android 12 or above.
If you’re encountering this issue in a Flutter app, it means that you need to make sure that you specify one of these flags when creating a PendingIntent in your Android-specific code (usually located in the android
directory of your Flutter project).
Learn more about our Flutter Development Services.
Now, the main question is how to resolve this issue.
While solving this issue you need to consider the below point carefully and follow the instructions on it:-
“W/System.err( 9990): 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.”
Here you will need to change the Flag Mutability and Pending Intent in your project.
You can set your pending intent and Flag Mutability as below:-
1 2 3 4 5 6 |
val updatedPendingIntent = PendingIntent.getActivity( applicationContext, NOTIFICATION_REQUEST_CODE, updatedIntent, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT ) |
In this blog, we have checked one of the most common gradle error popups, with the Flutter applications.
Thanks for reading this blog. You can also check out more amazing blogs on Flutter with Mobikul blogs.
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.