首页 文章

Firebase Android应用程序上的Google登录失败 - GoogleSignInResult @ a84236f

提问于
浏览
0

我正在使用Firebase和Google Signin将用户身份验证到Android应用中 . 这个应用程序正常工作,但我重新安装了Ubuntu和Android Studio . 现在它没有更多工作 .

我使用Google登录进行身份验证的电子邮件和密码(使用Google的电子邮件和密码), error 返回的是 GoogleSignInResult@a84236f 返回tis值的函数是:

onActivityResult(int requestCode,int resultCode,Intent data)

这段代码是什么意思: GoogleSignInResult@a84236f

result.isSuccess()的结果是: false .

功能完成是:

@Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
        Log.d("DEIP","request code = 9001? ="+requestCode);
        if (requestCode == RC_SIGN_IN) {
            GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
            Log.d(TAG," isSucess? result.toString  ="+result.toString());
            Log.d(TAG," +result.isSuccess()   ="+result.isSuccess());
            if (result.isSuccess()) {
                // Google Sign In was successful, authenticate with Firebase
                GoogleSignInAccount account = result.getSignInAccount();
                firebaseAuthWithGoogle(account);
            } else {
                // Google Sign In failed
                Log.e(TAG, "Google Sign In failed.");
                Log.d(TAG,"Failed into onActivityResult");
            }
        }
    }

失败的结果是:

isSucess? result.toString =com.google.android.gms.auth.api.signin**.GoogleSignInResult@a84236f**:result.isSuccess()= false

另一件事,我用命令keytool -exportcert -list -v -alias androiddebugkey -keystore~ / .android / debug.keystore放入指纹

给我一个 SHA1 fingerprint ,但是当我将此值放入Firebase控制台指纹时,firebase.console.google.com网站 recognize like a SHA256 指纹 .

可能这个问题与上面的问题有关吗?我该如何解决?

我试过了:

  • 重新生成SHA1指纹 . - Firebase向我提供了我的sh1指纹是256指纹的信息 . 我也生成了释放键和调试键 .

  • 我将新文件google-services.json放入Android Studio的app目录中 .

  • 我试图将应用程序运行到物理手机中,但错误与虚拟手机相同 .

  • 将包名称与文件AndroidManifes.xml进行比较,并将此字段与Firebase控制台进行比较 .

  • 清理项目并重建 .

  • 禁用即时运行

  • 我把依赖项的新值(9.8.0)编译为compile 'com.google.firebase:firebase-auth:9.8.0'

dependencies {compile fileTree(dir:'libs',include:['* .jar'])testCompile'junit:junit:4.12'

compile 'com.android.support:design:24.0.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.android.support:appcompat-v7:24.0.0'

// Google
compile 'com.google.android.gms:play-services-auth:9.8.0'

// Firebase
compile 'com.google.firebase:firebase-database:9.8.0'
compile 'com.google.firebase:firebase-auth:9.8.0'
compile 'com.google.firebase:firebase-config:9.8.0'
compile 'com.google.android.gms:play-services-appinvite:9.8.0'
compile 'com.google.firebase:firebase-messaging:9.8.0'
compile 'com.google.android.gms:play-services-ads:9.8.0'
compile 'com.google.firebase:firebase-crash:9.8.0'
compile 'com.google.firebase:firebase-analytics:9.8.0'
// Firebase UI
compile 'com.firebaseui:firebase-ui-database:0.4.0'

// Testing dependencies
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support:support-annotations:24.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta3'

//tryning to make COntrainlayout work
   //compile 'android.support.constraint.ConstraintLayout'
//

compile 'com.google.firebase:firebase-core:9.8.0'

}

apply plugin:'com.google.gms.google-services'apply plugin:'com.android.application'

2 回答

  • 0

    错误是我创建指纹的方式 . 命令

    keytool -exportcert -list -v \
    -alias androiddebugkey -keystore ~/.android/debug.keystore
    

    对我不起作用 . 创建调试指纹的方法是:“[基本上,在Android Studio中,打开最右边的Gradle菜单,从下拉列表中打开android-start(如果没有显示则刷新),打开任务,打开android,双击signingReport . 显示在此链接:https://github.com/firebase/friendlychat/issues/11

    或者这个视频教程[https://www.youtube.com/watch?v=m_9tk7ME4ZU][2]

    Firebase团队帮助我解决了这个错误 .

  • 1

    我有同样的问题,我正在尝试this tutorial

    它说在这个步骤中解决了这个问题:

    • 使用发布密钥库的SHA1更新Firebase控制台 .

    • 重新下载google-config.json文件 .

    • 将发布密钥库放在与gradle文件相同的文件夹中,并使用以下代码更新gradle .

相关问题