1
public void checkEmailExistsOrNot() {

    FirebaseAuth.fetchSignInMethodsForEmail(emailET)
            .addOnCompleteListener(new OnCompleteListener<SignInMethodQueryResult>() {
                @Override
                public void onComplete(@NonNull Task<SignInMethodQueryResult> task) {

                    boolean isNewUser = task.getResult().getSignInMethods().isEmpty();

                    if (isNewUser) {
                        Log.e("TAG", "Is New User!");
                    } else {
                        Log.e("TAG", "Is Old User!");
                    }

                }
            });

On the code: fetchSignInMethodsForEmail

Non-static method 'fetchSignInMethodsForEmail(java.lang.String)' cannot be referenced from a static context

  • You must create an instance of the `FirebaseAuth` class first; the error states you are treating it like a static method. So your first line should be like `FirebaseAuth auth = FirebaseAuth.getInstance();`, then you should follow it up with something like `auth.fetchSignInMethodsForEmail(emailET)`. Instance methods vs. static methods. – Max Voisard May 02 '22 at 22:49
  • This is nothing about Firebase, emails or Android Studio. You could have searched for the error and get https://stackoverflow.com/search?q=java+non+static+method+cannot+be+referenced – Queeg May 03 '22 at 06:08

0 Answers0