Trouble with user registration in Firebase

空扰寡人 提交于 2019-12-11 14:28:06

问题


I've successfully connected to firebase and added all required dependencies but i am unable to register users into it.The code I wrote is in this picture I've also provided the gradle dependencies list please check where i am going wrong

The code I've written

I've enabled email and password verification in firebase yet it doesnt work.

Here is the list of my dependencies.

 dependencies 
 {
   implementation fileTree(dir: 'libs', include: ['*.jar'])
   implementation 'com.android.support:support-v4:28.0.0'
   implementation 'com.google.firebase:firebase-core:16.0.9'
   implementation 'com.android.support:design:28.0.0'
   implementation 'com.google.firebase:firebase-database:16.0.1'
   implementation 'com.google.firebase:firebase-auth:17.0.0'
   implementation 'com.android.support:cardview-v7:28.0.0'
   implementation 'com.rengwuxian.materialedittext:library:2.1.4'
   implementation 'com.android.support.constraint:constraint-layout:1.1.3'
   testImplementation 'junit:junit:4.12'
   androidTestImplementation 'com.android.support.test:runner:1.0.2'
   androidTestImplementation 'com.android.support.test.espresso:espresso- 
   core:3.0.2'
 }

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

回答1:


You'd need to give more information before the community can help solve your problem for you.

To get more information, I'd suggest logging out the exception and sharing it. Add the following line in the else{} block of your code:

Log.w(TAG, "createUserWithEmail:failure", task.getException());

So it looks something like this (I wasn't able to copy paste your code because it was an image - it's always helpful to share your code as text in questions so others can copy and correct it):

 mAuth.createUserWithEmailAndPassword(email, password)
                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        if (task.isSuccessful()) {
                            // your code here
                        } else {
                            //your toast here                               
                Log.w(TAG,"createUserWithEmail:failure",task.getException());
                        }

The logged out error can be found in the Logcat section at the bottom of Android Studio:

Thanks



来源:https://stackoverflow.com/questions/56210382/trouble-with-user-registration-in-firebase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!