Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase auth issue in Android 12 #3620

Closed
reporterma opened this issue Apr 5, 2022 · 7 comments
Closed

Firebase auth issue in Android 12 #3620

reporterma opened this issue Apr 5, 2022 · 7 comments

Comments

@reporterma
Copy link

Hi I am using email login but it crashes on Android 12. I am not using PendingIntent in my code. Is there a way to fix it, please?

Fatal Exception: java.lang.IllegalArgumentException: com.example.monuments: 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:382)
at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:465)
at android.app.PendingIntent.getActivity(PendingIntent.java:451)
at android.app.PendingIntent.getActivity(PendingIntent.java:415)
at com.google.android.gms.internal.auth-api.zzr.zzc(com.google.android.gms:play-services-auth@@19.0.0:19)
at com.google.android.gms.auth.api.credentials.CredentialsClient.getHintPickerIntent(com.google.android.gms:play-services-auth@@19.0.0:10)
at com.firebase.ui.auth.ui.email.CheckEmailHandler.fetchCredential(CheckEmailHandler.java:29)
at com.firebase.ui.auth.ui.email.CheckEmailFragment.onActivityCreated(CheckEmailFragment.java:174)
at androidx.fragment.app.Fragment.performActivityCreated(Fragment.java:2996)
at androidx.fragment.app.FragmentStateManager.activityCreated(FragmentStateManager.java:580)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:285)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3138)
at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:3072)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:251)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:502)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:246)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1455)
at android.app.Activity.performStart(Activity.java:8307)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:4056)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2434)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8633)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1133)
fatal crash

@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@reporterma
Copy link
Author

I have tried firebase-bom:29.3.0, not working
and versioning individually:
implementation 'com.google.firebase:firebase-analytics:20.1.2'
implementation 'com.google.firebase:firebase-auth:21.0.3'
implementation 'com.google.firebase:firebase-database:20.0.4'
implementation 'com.google.firebase:firebase-crashlytics:18.2.9'
not working...

@vasuthakker
Copy link

Any update or workaround for this issue?

@argzdev
Copy link
Contributor

argzdev commented Apr 6, 2022

Hi @reporterma & @vasuthakker, thanks for reporting. It looks like this error comes from the pre-built FirebaseUI.
Did you use com.firebaseui:firebase-ui-auth? If so, what version did you use?

I'm unable to reproduce the issue, however I was able to pin point the issue. Upon checking the latest code repo of com.firebaseui:firebase-ui-auth, the problem lies within the zzr class of com.google.android.gms.internal.auth-api.zzr which is from a seperate dependency com.google.android.gms:play-services-auth:19.0.0@aar

public static PendingIntent zzc(Context var0, @Nullable AuthCredentialsOptions var1, HintRequest var2, @Nullable String var3) {
    /** other code **/
    return PendingIntent.getActivity(var0, 2000, var8, 134217728);
 }

The flag FLAG_UPDATE_CURRENT or 134217728 is being set in the PendingIntent upon return. It should be 67108864 | 134217728 or 201326592 as the bitwise OR of the 2 flags FLAG_IMMUTABLE and FLAG_UPDATE_CURRENT. E.g.:

public static PendingIntent zzc(Context var0, @Nullable AuthCredentialsOptions var1, HintRequest var2, @Nullable String var3) {
    /** other code **/
    return PendingIntent.getActivity(var0, 2000, var8, 67108864 | 134217728);
}

Unfortunately, since this is an external private dependency, I can't create a pull request for this. However, I'll notify an engineer about the findings and see what we can do here.

@reporterma
Copy link
Author

Thank you argzdev. I am using com.firebaseui:firebase-ui-auth: 8.0.0
I may raise an issue in firebaseui as well.

@reporterma
Copy link
Author

firebase/FirebaseUI-Android#1999
basically the solution at the moment is to drop firebaseUI.

@argzdev
Copy link
Contributor

argzdev commented Apr 6, 2022

@reporterma, you could try the solution provided in the comments. I think that'll help as a workaround. Anyway, since this has already been reported in FirebaseUI, and it looks like it's been there for a while. I'll be closing this issue for now to avoid duplicates. Thanks again!

@argzdev argzdev closed this as completed Apr 6, 2022
@firebase firebase locked and limited conversation to collaborators May 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants