FirebaseUI-Android: Sign-in intent gets suck and never launched
Describe your environment
- Android device: Samsung Note10 Plus
- Android OS version: 12
- Google Play Services version: _____
- Firebase SDK version: 26.3.0
- FirebaseUI version: 7.1.1
Step 3: Describe the problem:
Some users reported the authentication picker activity is not loaded. When they tap on the button which launches the sign-in intent they get stuck.
Steps to reproduce:
I couldn’t replicate it on my device.
Observed Results:
I guessed it might be related to Google Smart lock, so I asked the users to remove the credentials or app or even disable it but they didn’t help.
Relevant Code:
private void onLoginButton(View view) {
...
startActivityForResult(buildSignInIntent(), RC_SIGN_IN);
...
}
@NonNull
private Intent buildSignInIntent() {
List<AuthUI.IdpConfig> selectedProviders = new ArrayList<>();
selectedProviders.add(new AuthUI.IdpConfig.EmailBuilder().build());
selectedProviders.add(new AuthUI.IdpConfig.FacebookBuilder().build());
selectedProviders.add(new AuthUI.IdpConfig.GoogleBuilder().build());
AuthUI.SignInIntentBuilder builder = AuthUI.getInstance().createSignInIntentBuilder()
.setLogo(AuthUI.NO_LOGO)
.setTheme(R.style.AppTheme)
.setIsSmartLockEnabled(!BuildConfig.DEBUG /* credentials */, true /* hints */)
.setAvailableProviders(selectedProviders);
AuthMethodPickerLayout customLayout = new AuthMethodPickerLayout
.Builder(R.layout.fragment_register)
.setGoogleButtonId(R.id.custom_google_signin_button)
.setEmailButtonId(R.id.custom_email_signin_button)
.setFacebookButtonId(R.id.custom_facebook_signin_button)
.setTosAndPrivacyPolicyId(R.id.custom_tos)
.build();
builder.setAuthMethodPickerLayout(customLayout);
builder.setTosAndPrivacyPolicyUrls(Constants.TermsOfUseURL, Constants.PrivacyPolicyURL);
return builder.build();
}
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 20 (1 by maintainers)
If you have recently upgraded to AGP 8.0 or if you have enabled
android.enableR8.fullMode=true
then this might fix it for you: https://github.com/firebase/firebase-android-sdk/issues/2124#issuecomment-920922929We have released a new version with 8.0.1 and I’m waiting for feedbacks.
After @jftabord reproduced the bug on a demoFirebaseUI app and after we noticed the request was trying to access to credential at the Google Play Services/ Smart Lock https://github.com/firebase/FirebaseUI-Android/blob/5b6c9f01f5a674d754d8e9b1242197fe040086e7/auth/src/main/java/com/firebase/ui/auth/data/remote/SignInKickstarter.java#L97-L121 We have found:
Deactive the Google Smart Lock
.setIsSmartLockEnabled(false)
(true by default) has solved the problem for our users. Here why: The if block statement has two conditions; I will omit thewillRequestCredentials
because is normallytrue
. The other onegetArguments().enableCredentials
is set by the setIsSmartLockEnabled@AuthUI.java which is also set by the Intent created by our apps.So being the if block statement
false
the execution goes down through the method startAuthMethodChoice that somehow returns the control to your app always.So basically, for some users, Smart Lock might fail and the Intent is not giving back control to the app that has launched it (spinner rolling non-stop) due to failures in the request.
We had the same problem using 8.0.0, and as a workaround in one of the phones we use for testing, we cleaned the “google play services” cache and it resolves the issue. The list of devices where we have the issue reported:
Xiaomi Redmi 9A/x64/Android 11 API 30 Vivo/x64/Android 12 API 31
com.firebaseui:firebase-ui-auth:8.0.0 com.google.firebase:firebase-bom:30.0.1