Firebase AuthUI在无Google Play服务设备上登录失败的问题求助
Firebase AuthUI在无Google Play服务设备上登录失败的问题求助
大家好,我遇到了一个棘手的问题,想请教一下各位大佬。我的应用在Amazon Appstore被拒了,原因是使用Firebase AuthUI登录时出现错误。
我做了些调研,发现所有亚马逊Fire设备都没有预装Google Play服务,于是我在没有Google服务的模拟器上测试,果然也遇到了同样的错误。
奇怪的是,Firebase Auth 20.0.0版本明明引入了一个功能——"Firebase Authentication Android库现在可以在没有Google Play服务的设备上运行",但我还是碰到了问题。
下面是我的登录实现代码:
public void signIn() { List<AuthUI.IdpConfig> listProviders = Arrays.asList( new AuthUI.IdpConfig.GoogleBuilder().build(), new AuthUI.IdpConfig.FacebookBuilder().build(), new AuthUI.IdpConfig.TwitterBuilder().build(), new AuthUI.IdpConfig.YahooBuilder().build(), new AuthUI.IdpConfig.EmailBuilder().build() ); // Create and launch sign-in intent Intent intentSignIn = AuthUI.getInstance() .createSignInIntentBuilder() .setAvailableProviders(listProviders) .setTheme(R.style.LoginTheme) .setLogo(R.drawable.login_icon) .setTosAndPrivacyPolicyUrls( "URL", "URL") .build(); activityResultLauncherSignIn.launch(intentSignIn); } // Activity result launcher setup private final ActivityResultLauncher<Intent> activityResultLauncherSignIn = registerForActivityResult( new FirebaseAuthUIActivityResultContract(), this::onSignInResult ); private void onSignInResult(FirebaseAuthUIAuthenticationResult firebaseAuthUIAuthenticationResult) { IdpResponse idpResponse = firebaseAuthUIAuthenticationResult.getIdpResponse(); if (firebaseAuthUIAuthenticationResult.getResultCode() == RESULT_OK) { if (firebaseUser != null && firebaseUser.getEmail() != null && !firebaseUser.isEmailVerified()) sendVerificationEmail(); } else { // Sign in failed handling if (idpResponse != null && idpResponse.getError() != null) { Log.e(TAG, "Problem with Firebase authentication: " + idpResponse.getError().getErrorCode()); } } }
我收到的错误日志如下:
Problem with Firebase authentication: 0
com.google.android.play.core.install.InstallException: -9: Install Error(-9): The Play Store app is either not installed or not the official version.
当前我使用的依赖如下:
implementation platform('com.google.firebase:firebase-bom:32.3.1') implementation 'com.firebaseui:firebase-ui-auth:8.0.2' implementation 'com.google.android.gms:play-services-auth:20.7.0'
备注:内容来源于stack exchange,提问作者Miha M
相关产品推荐
相关产品推荐

