I\'m trying to use the createUserWithEmailAndPassword
method to create users but not able to do so.
The OnAuthenticate method is being called but user object is
I spent 2 days searching for this solution, only to find out it is because of the emulator. Try to use a smartphone to run your app. For me it worked.
I think the problem is that you might not have added the firebase SDKs in your App.
Add the following implementation inside the dependencies in your module(app-level) Gradle file(app/build.gradle
):
dependencies {
implementation 'com.google.firebase:firebase-auth:19.3.1'
}
I have the same problem.
change:
mAuth.createUserWithEmailAndPassword("9199999989@pintech.com", "corrfecthorsebatterystaple")
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>()
to:
mAuth.createUserWithEmailAndPassword("9199999989@pintech.com", "corrfecthorsebatterystaple")
.addOnCompleteListener(MainActivity.this, new OnCompleteListener<AuthResult>()
I had this problem too. The password I was testing the app with was just too short. I extended it to a longer password and it worked. You have to meet google's password complexity standards.
For me, the way I solved this issue was firstly to make sure that I had enabled Email/Password signInAuth in firebase
lastly I made sure that the line
mAuth.createUserWithEmailAndPassword(username,password)
.addOnCompleteListener(**SignUpActivity.this**, task -> {
... }) had myactivity.this instead of this alone as the context
Just for anyone still looking something that hasn't worked above:
I found that using your activity name before the this
keyword in the first parameter of the .addOnCompleteListener
works for me.
eg. .addOnCompleteListener(LoginActivity.this, etc..);
Hope this helps anyone still looking, Adam