Google登录ApiException:10:

时间:2019-07-09 18:28:49

标签: java android firebase gradle google-signin

我一直遵循this在我的应用中实施google登录。我遵循了每个步骤,在firebase和应用程序中设置了我的SHA1和Web客户端ID。

会发生什么:我单击按钮登录Google。出现Google提示,然后选择了Promtm帐户。

我在这里四处敬酒,看看代码在哪里卡住和

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

        // Result returned 

from launching the Intent from GoogleSignInApi.getSignInIntent(...);
    if (requestCode == GOOGLE_SIGN) {
        Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
        try {
            // Google Sign In was successful, authenticate with Firebase
            GoogleSignInAccount account = task.getResult(ApiException.class);
            firebaseAuthWithGoogle(account);
        } catch (ApiException e) {
            alert("You suck even more"); <---THIS ONE
            // Google Sign In failed, update UI appropriately
            // ...
        }
    }
}

显示捕获中的吐司(ApiException e)。为什么它卡在onActivityResult上?

这是gradle:

 dependencies {
implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'com.google.firebase:firebase-auth:17.0.0'
    implementation 'com.google.firebase:firebase-storage:17.0.0'
    implementation 'com.firebaseui:firebase-ui-storage:4.1.0'
    implementation 'com.firebaseui:firebase-ui-database:4.1.0'
    implementation 'com.google.android.gms:play-services-auth:15.0.1'


}

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

或者至少与Google相关。

我一直关注有关此aPI例外的一切,但没有帮助。 地狱,我什至无奈地删除了整个Firebase项目,并新建了它,并做了this ...但是什么也没有...我什至不能这样做,因为我无法在Google中放置相同的SHA1开发人员和Firebase,系统提示我输入广告 拜托,这一定比这容易得多,我想我现在对此已经太过思索了

请帮助我,就像我花5个小时浏览github问题一样。

1 个答案:

答案 0 :(得分:0)

您是否添加了支持电子邮件地址。因为这是设置firebase时经常使用的方法。没有支持电子邮件地址,我们可以从Firebase获得所需的结果