java - Android:Firebase登录失败密码无效或用户没有密码

标签 java android firebase firebase-authentication

我正在尝试使用 firebase 创建一个包含用户个人资料的简单应用程序,但遇到了问题。注册功能运行良好,我可以在 Firebase 控制台中看到注册帐户,但登录功能运行不佳。我收到“密码无效或用户没有密码”。异常(exception)。任何人都可以帮我解决这个问题吗?我的登录方法如下所示。

 private void userLogin(){
    String email = emailText.getText().toString().trim();
    String password = passwordText.getText().toString().trim();


    if (TextUtils.isEmpty(email)){
        Toast.makeText(this,"Please enter email", Toast.LENGTH_SHORT).show();
        return;
    }
    if (TextUtils.isEmpty(password)) {
        Toast.makeText(this,"Please enter password", Toast.LENGTH_SHORT).show();
        return;
    }
    firebaseAuth.signInWithEmailAndPassword(email, password)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                   if(task.isSuccessful()){
                       Toast.makeText(LogIn.this,"You are logged in", Toast.LENGTH_SHORT).show();
                   }
                   else{
                       Toast.makeText(LogIn.this,"MISTAKE", Toast.LENGTH_SHORT).show();
                       Log.d("z", "onComplete: Failed=" + task.getException().getMessage());
                   }
                }
            });
}

日志猫:

    05-13 04:49:17.944 10714-10714/? I/art: Not late-enabling -Xcheck:jni (already on)
05-13 04:49:17.944 10714-10714/? W/art: Unexpected CPU variant for X86 using defaults: x86
05-13 04:49:17.964 10714-10721/? E/art: Failed sending reply to debugger: Broken pipe
05-13 04:49:17.964 10714-10721/? I/art: Debugger is no longer active
    Starting a blocking GC Instrumentation
05-13 04:49:18.144 10714-10714/? W/System: ClassLoader referenced unknown path: /data/app/com.example.gmachine.mychat-1/lib/x86
05-13 04:49:18.231 10714-10714/? D/FirebaseAuth: Notifying id token listeners about user ( KUXl4u7sy6OdwE0P3fmCRWyHugz1 ).
05-13 04:49:18.250 10714-10714/? D/FirebaseAuth: Notifying id token listeners about user ( KUXl4u7sy6OdwE0P3fmCRWyHugz1 ).
05-13 04:49:18.258 10714-10714/? D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
05-13 04:49:18.324 10714-10714/? V/FA: Registered activity lifecycle callback
05-13 04:49:18.328 10714-10714/? I/FirebaseInitProvider: FirebaseApp initialization successful
05-13 04:49:18.333 10714-10714/? I/InstantRun: starting instant run server: is main process
05-13 04:49:18.354 10714-10738/? V/FA: Collection enabled
    App package, google app id: com.example.gmachine.mychat, 1:411464926772:android:67ab72bb5465b580
05-13 04:49:18.354 10714-10738/? I/FA: App measurement is starting up, version: 12451
    To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
05-13 04:49:18.355 10714-10738/? I/FA: To enable faster debug mode event logging run:
      adb shell setprop debug.firebase.analytics.app com.example.gmachine.mychat
05-13 04:49:18.355 10714-10738/? D/FA: Debug-level message logging enabled
05-13 04:49:18.372 10714-10738/? V/FA: Cancelling job. JobID: 67470213
05-13 04:49:18.424 10714-10714/? W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
05-13 04:49:18.430 10714-10738/? V/FA: Connecting to remote service
05-13 04:49:18.432 10714-10714/? V/FA: onActivityCreated
05-13 04:49:18.503 10714-10738/? V/FA: Connection attempt already in progress
05-13 04:49:18.590 10714-10738/? I/FA: Tag Manager is not found and thus will not be used
05-13 04:49:18.600 10714-10738/? D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=LogIn, firebase_screen_id(_si)=-7531630852293217533}]
05-13 04:49:18.617 10714-10738/? V/FA: Connection attempt already in progress
05-13 04:49:18.618 10714-10738/? V/FA: Connection attempt already in progress
05-13 04:49:18.622 10714-10738/? V/FA: Activity resumed, time: 28255253
05-13 04:49:18.650 10714-10714/? D/FirebaseApp: Notifying auth state listeners.
    Notified 0 auth state listeners.
05-13 04:49:18.651 10714-10714/? D/FirebaseApp: Notifying auth state listeners.
    Notified 0 auth state listeners.
05-13 04:49:18.736 10714-10743/? I/OpenGLRenderer: Initialized EGL, version 1.4
05-13 04:49:18.736 10714-10743/? D/OpenGLRenderer: Swap behavior 1
05-13 04:49:18.737 10714-10743/? W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
05-13 04:49:18.737 10714-10743/? D/OpenGLRenderer: Swap behavior 0
05-13 04:49:18.758 10714-10743/? D/EGL_emulation: eglCreateContext: 0xa9b858a0: maj 2 min 0 rcv 2
05-13 04:49:18.818 10714-10743/? D/EGL_emulation: eglMakeCurrent: 0xa9b858a0: ver 2 0 (tinfo 0x8c54b1d0)
05-13 04:49:18.858 10714-10714/? W/art: Before Android 4.1, method int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
05-13 04:49:18.866 10714-10743/? D/EGL_emulation: eglMakeCurrent: 0xa9b858a0: ver 2 0 (tinfo 0x8c54b1d0)
05-13 04:49:18.991 10714-10738/com.example.gmachine.mychat D/FA: Connected to remote service
05-13 04:49:18.991 10714-10738/com.example.gmachine.mychat V/FA: Processing queued up service tasks: 4
05-13 04:49:24.124 10714-10738/com.example.gmachine.mychat V/FA: Inactivity, disconnecting from the service
05-13 04:49:28.720 10714-10719/com.example.gmachine.mychat I/art: Do partial code cache collection, code=27KB, data=29KB
05-13 04:49:28.722 10714-10719/com.example.gmachine.mychat I/art: After code cache collection, code=27KB, data=29KB
    Increasing code cache capacity to 128KB
05-13 04:49:30.937 10714-10714/com.example.gmachine.mychat W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
05-13 04:49:33.192 10714-10719/com.example.gmachine.mychat I/art: Do partial code cache collection, code=62KB, data=55KB
    After code cache collection, code=62KB, data=55KB
    Increasing code cache capacity to 256KB
05-13 04:49:34.038 10714-10714/com.example.gmachine.mychat W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
05-13 04:49:38.664 10714-10714/com.example.gmachine.mychat W/System: ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
05-13 04:49:38.664 10714-10714/com.example.gmachine.mychat D/ApplicationLoaders: ignored Vulkan layer search path /system/priv-app/PrebuiltGmsCore/lib/x86:/system/fake-libs:/system/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk!/lib/x86:/system/lib:/vendor/lib for namespace 0xa9d54090
05-13 04:49:38.695 10714-10714/com.example.gmachine.mychat W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
05-13 04:49:38.695 10714-10714/com.example.gmachine.mychat W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@1b80aea
05-13 04:49:38.717 10714-10988/com.example.gmachine.mychat W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
05-13 04:49:38.723 10714-10988/com.example.gmachine.mychat I/FirebaseAuth: [FirebaseAuth:] Loading module via FirebaseOptions.
    [FirebaseAuth:] Preparing to create service connection to gms implementation
05-13 04:49:39.351 10714-10714/com.example.gmachine.mychat D/z: onComplete: Failed=The password is invalid or the user does not have a password.
05-13 04:49:39.493 10714-10743/com.example.gmachine.mychat D/EGL_emulation: eglMakeCurrent: 0xa9b858a0: ver 2 0 (tinfo 0x8c54b1d0)
05-13 04:49:39.529 10714-10743/com.example.gmachine.mychat D/EGL_emulation: eglMakeCurrent: 0xa9b858a0: ver 2 0 (tinfo 0x8c54b1d0)
05-13 04:54:38.844 10714-10988/com.example.gmachine.mychat I/FirebaseAuth: [FirebaseAuth:] Loading module via FirebaseOptions.
    [FirebaseAuth:] Preparing to create service connection to gms implementation
05-13 05:02:01.317 10714-10739/com.example.gmachine.mychat W/System: ClassLoader referenced unknown path: /data/data/com.example.gmachine.mychat/lib
05-13 05:02:01.346 10714-19878/com.example.gmachine.mychat V/FA: Recording user engagement, ms: 762757
05-13 05:02:01.347 10714-19878/com.example.gmachine.mychat V/FA: Connecting to remote service
05-13 05:02:01.348 10714-19878/com.example.gmachine.mychat V/FA: Activity paused, time: 29018004
05-13 05:02:01.408 10714-10743/com.example.gmachine.mychat D/EGL_emulation: eglMakeCurrent: 0xa9b858a0: ver 2 0 (tinfo 0x8c54b1d0)
05-13 05:02:01.416 10714-19878/com.example.gmachine.mychat D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=762757, firebase_screen_class(_sc)=LogIn, firebase_screen_id(_si)=-7531630852293217533}]
05-13 05:02:01.535 10714-10714/com.example.gmachine.mychat V/FA: onActivityCreated
05-13 05:02:01.538 10714-19878/com.example.gmachine.mychat V/FA: Connection attempt already in progress
05-13 05:02:01.663 10714-19878/com.example.gmachine.mychat V/FA: Connection attempt already in progress
    Activity resumed, time: 29018325
05-13 05:02:02.308 10714-19878/com.example.gmachine.mychat D/FA: Connected to remote service
05-13 05:02:02.308 10714-19878/com.example.gmachine.mychat V/FA: Processing queued up service tasks: 3
05-13 05:02:02.310 10714-10714/com.example.gmachine.mychat I/Choreographer: Skipped 33 frames!  The application may be doing too much work on its main thread.
05-13 05:02:02.317 10714-10743/com.example.gmachine.mychat D/EGL_emulation: eglMakeCurrent: 0xa9b858a0: ver 2 0 (tinfo 0x8c54b1d0)
05-13 05:02:02.380 10714-10743/com.example.gmachine.mychat D/EGL_emulation: eglMakeCurrent: 0xa9b858a0: ver 2 0 (tinfo 0x8c54b1d0)
05-13 05:02:02.393 10714-10743/com.example.gmachine.mychat D/EGL_emulation: eglMakeCurrent: 0xa9b858a0: ver 2 0 (tinfo 0x8c54b1d0)
05-13 05:02:07.340 10714-19878/com.example.gmachine.mychat V/FA: Inactivity, disconnecting from the service
05-13 05:02:11.505 10714-10743/com.example.gmachine.mychat D/EGL_emulation: eglMakeCurrent: 0xa9b858a0: ver 2 0 (tinfo 0x8c54b1d0)
05-13 05:02:11.772 10714-10743/com.example.gmachine.mychat D/EGL_emulation: eglMakeCurrent: 0xa9b858a0: ver 2 0 (tinfo 0x8c54b1d0)
05-13 05:02:13.726 10714-10743/com.example.gmachine.mychat D/EGL_emulation: eglMakeCurrent: 0xa9b858a0: ver 2 0 (tinfo 0x8c54b1d0)
05-13 05:02:14.138 10714-10743/com.example.gmachine.mychat D/EGL_emulation: eglMakeCurrent: 0xa9b858a0: ver 2 0 (tinfo 0x8c54b1d0)
05-13 05:02:29.855 10714-10714/com.example.gmachine.mychat W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
05-13 05:02:29.940 10714-10743/com.example.gmachine.mychat D/EGL_emulation: eglMakeCurrent: 0xa9b858a0: ver 2 0 (tinfo 0x8c54b1d0)
05-13 05:02:30.353 10714-10743/com.example.gmachine.mychat D/EGL_emulation: eglMakeCurrent: 0xa9b858a0: ver 2 0 (tinfo 0x8c54b1d0)
05-13 05:02:33.796 10714-10714/com.example.gmachine.mychat W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@1b80aea
05-13 05:02:33.797 10714-10988/com.example.gmachine.mychat W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
05-13 05:02:33.797 10714-10988/com.example.gmachine.mychat I/FirebaseAuth: [FirebaseAuth:] Loading module via FirebaseOptions.
    [FirebaseAuth:] Preparing to create service connection to gms implementation
05-13 05:02:34.840 10714-10714/com.example.gmachine.mychat D/z: onComplete: Failed=The password is invalid or the user does not have a password.
05-13 05:02:34.889 10714-10743/com.example.gmachine.mychat D/EGL_emulation: eglMakeCurrent: 0xa9b858a0: ver 2 0 (tinfo 0x8c54b1d0)
05-13 05:02:34.913 10714-10743/com.example.gmachine.mychat D/EGL_emulation: eglMakeCurrent: 0xa9b858a0: ver 2 0 (tinfo 0x8c54b1d0)
05-13 05:07:33.860 10714-10988/com.example.gmachine.mychat I/FirebaseAuth: [FirebaseAuth:] Loading module via FirebaseOptions.
    [FirebaseAuth:] Preparing to create service connection to gms implementation

最佳答案

我遇到了同样的问题,后来才意识到我使用了错误的资源 ID 初始化了密码字段。确保这些是正确的

关于java - Android:Firebase登录失败密码无效或用户没有密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50313124/

相关文章:

java - 无法为 GrindPlayer videoplayer 编译 swf

java - 在Excel中创建下拉列表

javascript - 在 firebase 中存储 'long' 类型

javascript - 获取不返回 Promise 的函数的返回值

firebase - 如何让管理员批准新用户 firebase auth flutter?

java - 如何从网页打印数据?不是页面的html代码。

java - 如何使用自定义相等性过滤列表

java - Android:稍后安装的主应用程序和模块

android - 如何从来自android服务的视频网址获取缩略图?

android - 使用 gradle 为不同的应用程序风格使用不同的资源