Firebase Auth Ui Google登录“开发人员错误"; [英] Firebase Auth Ui Google Sign In "Developer Error"

查看:66
本文介绍了Firebase Auth Ui Google登录“开发人员错误";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用firebase和firebase auth ui库的项目.问题是当我尝试加载一两秒钟后,我无法使用Google登录进行登录,然后仅显示一条吐司消息,提示开发人员错误".我可以用电子邮件和密码登录.这仅是已签名的APK上的问题,当我调试Google时,登录工作正常.

I have a project using firebase and the firebase auth ui library. The problem is I can't sign in using Google sign-in, when I try it loads for a second or two and then just shows a toast message saying "Developer Error". I can sign in with email and password just fine. And this is only a problem on signed apks, when I am debugging Google, sign-in works fine.

在我的proguard-rules.pro中,我将minifyEnabled设置为false.

In my proguard-rules.pro I have minifyEnabled set to false.

我已经将SHA-1添加到我的firebase项目中,并下载了正确的json文件.

应用程序级别build.gradle的依赖项

dependency block from app level build.gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
})
    compile 'com.android.support:appcompat-v7:26.0.2'
    compile 'com.android.support:design:26.0.2'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:26.0.2'
    compile 'com.android.support:cardview-v7:26.0.2'
    compile 'com.google.firebase:firebase-database:11.4.2'
    compile 'com.google.firebase:firebase-auth:11.4.2'
    compile 'com.firebaseui:firebase-ui-auth:3.1.0'
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

这是我的AuthStateListener

here is my AuthStateListener

mAuthStateListener = new FirebaseAuth.AuthStateListener() {
            @Override
            public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                FirebaseUser user = firebaseAuth.getCurrentUser();
                if (user != null) {
                    signedInInitialized();
                } else {
                    signedOutCleanUp();
                    startActivityForResult(
                            AuthUI.getInstance()
                                    .createSignInIntentBuilder()
                                    .setTheme(R.style.FirebaseSignInTheme)
                                    .setIsSmartLockEnabled(false)
                                    .setAvailableProviders(
                                            Arrays.asList(new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build(),
                                                new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build()))
                                .build(),
                        RC_SIGN_IN);
                }
            }
        };

logcat不显示任何错误或任何内容.发生这种情况时,我会发布logcat,但我不知道如何从已签名的apk中获取logcat,因为这仅在对apk进行签名时发生.

The logcat shows no error or anything. I would post the logcat when this happens but I don't know how to get the logcat from a signed apk cause this only happens on sign the apk.

我已经尝试了好几天,但似乎没有任何进展.

I have tried to figure this out for days but seem to be making no head way.

谢谢

推荐答案

您已在控制台中添加了调试键的签名.但是释放密钥的签名不同.在Firebase控制台中添加用于签名apk的发布密钥签名.

You have added the signature of the debug key in the console. But the signature of release key is different. Add the signature of release key that you used to sign the apk in the firebase console.

首先使用以下命令生成密钥:

First generate key using following command:

keytool -list -v -keystore KEYSTORE_PATH -alias ALIAS_NAME

然后复制SHA-1校验和并转到:

Then copy the SHA-1 checksum and go to:

Firebase控制台>您的项目>应用程序设置>添加指纹

Firebase Console > Your project > Settings of the app > Add Fingerprint

这篇关于Firebase Auth Ui Google登录“开发人员错误";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆