title: Why I am getting such a message:java.lang.NoSuchMethodError: No virtual method fetchProvidersForEmail(Ljava/lang/String;)
body: <p>I am trying to create an Android program, and met an error of which I have no idea how to solve.
  My app crashes after I put in the email. I suspect that the problem is related with firebase. I have tried different ways of solving of this problem, such as changing the versions of firebase implementations, but without any success.</p>
  
  <p>Here is my code</p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>package com.chat.mychatapp;
  
  import androidx.annotation.Nullable;
  import androidx.appcompat.app.AppCompatActivity;
  
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.EditText;
  import android.widget.ListView;
  import android.widget.RelativeLayout;
  import android.widget.TextView;
  
  import com.firebase.ui.auth.AuthUI;
  import com.firebase.ui.database.FirebaseListAdapter;
  import com.github.library.bubbleview.BubbleTextView;
  import com.google.android.material.floatingactionbutton.FloatingActionButton;
  import com.google.android.material.snackbar.Snackbar;
  import com.google.firebase.auth.FirebaseAuth;
  import com.google.firebase.database.FirebaseDatabase;
  
  import android.text.format.DateFormat;
  
  import java.util.Objects;
  
  public class MainActivity extends AppCompatActivity {
  
      public static int SIGN_IN_CODE = 1;
      private RelativeLayout activity_main;
      private FirebaseListAdapter&lt;Message&gt; adapter;
      private FloatingActionButton sendBtn;
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          if(requestCode == SIGN_IN_CODE){
              if(resultCode == RESULT_OK){
                  Snackbar.make(activity_main, "You are authorized", Snackbar.LENGTH_LONG).show();
                  displayAllMessages();
              }else{
                  Snackbar.make(activity_main, "You are NOT authorized", Snackbar.LENGTH_LONG).show();
                  finish();
              }
          }
      }
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          activity_main = findViewById(R.id.activity_main);
          sendBtn = findViewById(R.id.sendBtn);
          sendBtn.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  EditText textField = findViewById(R.id.messageField);
                  if(textField.getText().toString().equals(""))
                      return;
                  FirebaseDatabase.getInstance().getReference().push().setValue(
                      new Message(Objects.requireNonNull(FirebaseAuth.getInstance().getCurrentUser()).getEmail(),
                              textField.getText().toString()
                      )
                  );
                  textField.setText("");
              }
          });
          //User not autorized
          if(FirebaseAuth.getInstance().getCurrentUser() == null){
              startActivityForResult(AuthUI.getInstance().createSignInIntentBuilder().build(), SIGN_IN_CODE);
          }else{
              Snackbar.make(activity_main, "You are authorized", Snackbar.LENGTH_LONG).show();
              displayAllMessages();
          }
  
      }
  
      private void displayAllMessages() {
          ListView listOfMessages = findViewById(R.id.messageList);
          adapter = new FirebaseListAdapter&lt;Message&gt;(this, Message.class, R.layout.list_item, FirebaseDatabase.getInstance().getReference()) {
              @Override
              protected void populateView(View v, Message model, int position) {
                  TextView m_user, m_time;
                  BubbleTextView m_text;
                  m_user = v.findViewById(R.id.messageUser);
                  m_time = v.findViewById(R.id.messageTime);
                  m_text = v.findViewById(R.id.messageText);
  
                  m_user.setText(model.getUserName());
                  m_text.setText(model.getMessage());
                  m_time.setText(DateFormat.format("dd-mm-yyyy  HH:mm:ss",model.getTime()));
  
              }
          };
          listOfMessages.setAdapter(adapter);
      }
  }
  </code></pre>
  
  <p><strong>build.gradle</strong></p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 29
      buildToolsVersion "29.0.2"
      defaultConfig {
          applicationId "com.chat.mychatapp"
          minSdkVersion 19
          targetSdkVersion 29
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'androidx.appcompat:appcompat:1.1.0'
      implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'androidx.test.ext:junit:1.1.1'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
      implementation 'com.google.firebase:firebase-analytics:17.2.1'
      implementation 'com.google.android.material:material:1.0.0'
      implementation 'androidx.legacy:legacy-support-v4:1.0.0'
  
      implementation 'com.google.android.gms:play-services-auth:17.0.0'
      implementation 'com.google.firebase:firebase-auth:19.2.0'
      implementation 'com.google.firebase:firebase-database:19.2.0'
      implementation 'com.firebaseui:firebase-ui:0.6.2'
      implementation 'com.github.lguipeng:BubbleView:1.0.1'
      //implementation 'com.google.firebase:firebase-firestore:21.3.1'
  
  }
  
  apply plugin: 'com.google.gms.google-services'
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
      Process: com.chat.mychatapp, PID: 18455
      java.lang.NoSuchMethodError: No virtual method fetchProvidersForEmail(Ljava/lang/String;)Lcom/google/android/gms/tasks/Task; in class Lcom/google/firebase/auth/FirebaseAuth; or its super classes (declaration of 'com.google.firebase.auth.FirebaseAuth' appears in /data/app/com.chat.mychatapp-s_3u6mmiv0A6KE9ijznfqQ==/base.apk)
          at com.firebase.ui.auth.ui.AcquireEmailHelper.checkAccountExists(AcquireEmailHelper.java:55)
          at com.firebase.ui.auth.ui.email.SignInNoPasswordActivity.onClick(SignInNoPasswordActivity.java:73)
          at android.view.View.performClick(View.java:7339)
          at android.widget.TextView.performClick(TextView.java:14222)
          at android.view.View.performClickInternal(View.java:7305)
          at android.view.View.access$3200(View.java:846)
          at android.view.View$PerformClick.run(View.java:27787)
          at android.os.Handler.handleCallback(Handler.java:873)
          at android.os.Handler.dispatchMessage(Handler.java:99)
          at android.os.Looper.loop(Looper.java:214)
          at android.app.ActivityThread.main(ActivityThread.java:7078)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
  </code></pre>