在其他计算机上运行应用程序时出现Firebase错误

时间:2018-10-01 17:24:05

标签: android firebase user-interface sha1

我遇到一个奇怪的错误,当其他人在他们的计算机上运行我的Android应用程序时,他们会收到此错误

"09-30 23:31:17.447 16756-16756/com.example.luthiers.capstone E/AuthUI: A sign-in error occurred.
    com.firebase.ui.auth.data.model.UserCancellationException: Unknown error
        at com.firebase.ui.auth.data.remote.GoogleSignInHandler.onActivityResult(GoogleSignInHandler.java:101)
        at com.firebase.ui.auth.ui.idp.SingleSignInActivity.onActivityResult(SingleSignInActivity.java:128)
        at android.app.Activity.dispatchActivityResult(Activity.java:7276)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4264)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:4312)
        at android.app.ActivityThread.-wrap19(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1644)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)"

此错误:

E/AuthUI: A sign-in error occurred.
com.firebase.ui.auth.FirebaseUiException: Code: 16, message: 16:
at com.firebase.ui.auth.data.remote.GoogleSignInHandler.onActivityResult(GoogleSignInHandler.java:106)
at com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity.onActivityResult(AuthMethodPickerActivity.java:242)

我已经做了大量研究,有人说这是因为他们必须将SHA-1放在Firebase设置上,但是这似乎很奇怪,因为在人们没有出现此错误之前,我也没有这样做。在项目中拥有所有这些SHA-1指纹似乎是合适的。 发生了什么,我该如何解决该错误?

通过我使用以下库的方式

    implementation 'com.google.firebase:firebase-database:16.0.2'
    // For Firebase Authentication
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    // For Firebase Analytics
    implementation 'com.google.firebase:firebase-core:16.0.3'
    // For Firebase Storage (pictures)
    implementation 'com.google.firebase:firebase-storage:16.0.2'
    implementation 'com.google.firebase:firebase-firestore:17.1.0'
    // For Firebase Messaging
    implementation 'com.google.firebase:firebase-messaging:17.3.2'
    // For UI
    implementation 'com.firebaseui:firebase-ui-auth:4.2.0'
    // For Firebase Crashlytics
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
    // For Firebase Performance
    implementation 'com.google.firebase:firebase-perf:16.1.0'
    // For Firebase Background logic
    implementation 'com.firebase:firebase-jobdispatcher:0.8.5'

唯一启用的登录方法是Google身份验证器

1 个答案:

答案 0 :(得分:0)

要解决此问题,您需要在现有依赖项之后添加以下代码行:

implementation 'com.google.android.gms:play-services-auth:16.0.0'