Haris
Haris

Reputation: 395

Firebase Authentication is not working on Android 12, Targeting S+ requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE

Firebase Authentication is not working on Android 12. The app crashes when the login is started and the error log in Android Studio is

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.

I tried updating the dependencies but it still does not work.

As far as I understood the dependency for Firebase Auth needs to be updated.

implementation "com.firebaseui:firebase-ui-auth:8.0.0"

Is there any way to fix this issue? How can we inform the Firebase developers about this issue, so that they can fix it ASAP?

Note: I know there are a lot of questions related to FLAG_IMMUTABLE or FLAG_MUTABLE but I need help with this one. I actually tried all those solutions they are not working.

Upvotes: 3

Views: 1942

Answers (2)

dtrejogo
dtrejogo

Reputation: 251

Besides updating the library, make sure you specify FLAG_IMMUTABLE or FLAG_MUTABLE when getting the result of a pending intent. It should look like this:

 PendingIntent resultPendingIntent =
            stackBuilder.getPendingIntent(
                    0,
                    PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE
            );

Upvotes: 0

Kintan Patel
Kintan Patel

Reputation: 1278

Add Below line in your app gradle file,

implementation "com.google.android.gms:play-services-auth:20.3.0"

Sync Project and Enjoy.

Upvotes: 4

Related Questions