【问题标题】:Firebase error when running app in other machine在其他机器上运行应用程序时出现 Firebase 错误
【发布时间】:2019-03-06 20:25:52
【问题描述】:

我遇到了一个奇怪的错误,当其他人在他们的机器上运行我的 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 身份验证器

【问题讨论】:

  • 你也加了implementation 'com.google.firebase:firebase-core:16.0.3'吗?
  • 是的,这会导致冲突吗?
  • 不,它肯定应该在那里。我问你是因为我没有在你的问题中看到它。请分享您的整个文件。您还确定在 Firebase 控制台中启用了身份验证吗?
  • 我已经更新了问题

标签: android firebase user-interface sha1


【解决方案1】:

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

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

【讨论】:

  • 嗨,安德里亚!你有没有试过我上面的解决方案,它有效吗?
猜你喜欢
  • 2021-07-11
  • 2018-01-08
  • 2018-03-05
  • 1970-01-01
  • 1970-01-01
  • 2019-08-30
  • 1970-01-01
  • 2012-11-12
  • 1970-01-01
相关资源
最近更新 更多