Started working with Firebase. I wrote the registration, everything works. I am writing an authorization, the code seems to be correct, but when I click to login, nothing happens. What could be the problem ?
public void signin(String email, String password){ FirebaseAuth auth = FirebaseAuth.getInstance(); if(auth.getCurrentUser() != null) { //Уже подписан, ничего не делать } else { auth.signInWithEmailAndPassword(email,password).addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if(task.isSuccessful()){ //Пользователь успешно подписан Toast.makeText(EmailPasswordActivity.this,"Welcome!",Toast.LENGTH_SHORT).show(); } } }); } } Gradle:
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.android.support:support-media-compat:28.0.0' 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' implementation 'com.android.support:support-v4:28.0.0' implementation 'com.google.firebase:firebase-core:16.0.4' implementation 'com.google.firebase:firebase-database:16.0.4' implementation 'com.google.firebase:firebase-auth:16.0.4'
elsetoif(task.isSuccessful())then nothing happens with this error. Add anelseand log everything that is inside theTask<AuthResult> task- there will be an explanation of whatTask<AuthResult> taskerror you had. - Yuriy SPb ♦task.getException().printStacktrace()- YuriiSPb ♦