title: constructor xxx in class xxx cannot be applied to given types;
body: <p>I'm building an android project with the help of an YouTube video and when I try to build it, it gives the following error message.</p>
  <blockquote>
  <p>error: constructor User in class User cannot be applied to given types;</p>
  <p>required: String,String,String,String,Uri</p>
  <p>found: String,String</p>
  <p>reason: actual and formal argument lists differ in length</p>
  </blockquote>
  <p>I have done the exactly same thing on the video and now I don't understand why it gives me such error.
  Here are the lines having errors. The lines between asterisk have underlined with red in the code.</p>
  <pre><code>Common.loggedUser = **new User(firebaseUser.getUid(), firebaseUser.getEmail())**;
  </code></pre>
  <pre><code>user_information.child(Common.loggedUser.**getUid**())
                                                  .setValue(Common.loggedUser);
  </code></pre>
  <pre><code> Paper.book().write(Common.USER_UID_SAVE_KEY, Common.loggedUser.**getUid**());
  </code></pre>
  <pre><code>tokens.child(firebaseUser.getUid())
                                  .setValue(InstanceIdResult.**getToken**());
  </code></pre>
  <p>Here is my full code</p>
  <pre><code>
  import android.Manifest;
  import android.content.Intent;
  import android.os.Bundle;
  import android.widget.Toast;
  
  import androidx.annotation.NonNull;
  import androidx.annotation.Nullable;
  import androidx.appcompat.app.AppCompatActivity;
  
  import com.firebase.ui.auth.AuthUI;
  import com.firebase.ui.auth.IdpResponse;
  import com.firebase.ui.auth.data.model.User;
  import com.google.android.gms.tasks.OnFailureListener;
  import com.google.android.gms.tasks.OnSuccessListener;
  import com.google.firebase.auth.FirebaseAuth;
  import com.google.firebase.auth.FirebaseUser;
  import com.google.firebase.database.DataSnapshot;
  import com.google.firebase.database.DatabaseError;
  import com.google.firebase.database.DatabaseReference;
  import com.google.firebase.database.FirebaseDatabase;
  import com.google.firebase.database.ValueEventListener;
  import com.google.firebase.iid.FirebaseInstanceId;
  import com.google.firebase.iid.InstanceIdResult;
  import com.karumi.dexter.Dexter;
  import com.karumi.dexter.PermissionToken;
  import com.karumi.dexter.listener.PermissionDeniedResponse;
  import com.karumi.dexter.listener.PermissionGrantedResponse;
  import com.karumi.dexter.listener.PermissionRequest;
  import com.karumi.dexter.listener.single.PermissionListener;
  import com.mynewrealtimelocationtracker.Utils.Common;
  
  import java.util.Arrays;
  import java.util.List;
  
  import io.paperdb.Paper;
  
  public class MainActivity extends AppCompatActivity {
  
      DatabaseReference user_information;
      private static final int MY_REQUEST_CODE = 4477;    //any number you want
      List&lt;AuthUI.IdpConfig&gt; providers;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          Paper.init(this);
  
          //Init firebase
          user_information = FirebaseDatabase.getInstance().getReference(Common.USER_INFORMATION);
  
          //Init provider
          providers = Arrays.asList(
                  new AuthUI.IdpConfig.EmailBuilder().build(),
                  new AuthUI.IdpConfig.GoogleBuilder().build()
          );
  
          //Request permission location
          Dexter.withActivity(this)
                  .withPermission(Manifest.permission.ACCESS_FINE_LOCATION)
                  .withListener(new PermissionListener() {
                      @Override
                      public void onPermissionGranted(PermissionGrantedResponse response) {
                          showSignInOptions();
                      }
  
                      @Override
                      public void onPermissionDenied(PermissionDeniedResponse response) {
                          Toast.makeText(MainActivity.this,&quot;You must accept permissionto use app&quot;,Toast.LENGTH_SHORT).show();
                      }
  
                      @Override
                      public void onPermissionRationaleShouldBeShown(PermissionRequest permission, PermissionToken token) {
  
                      }
                  }).check();
  
      }
  
      private void showSignInOptions() {
          startActivityForResult(
                  AuthUI.getInstance()
                          .createSignInIntentBuilder()
                          .setAvailableProviders(providers)
          .build(),MY_REQUEST_CODE);
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          if (requestCode == MY_REQUEST_CODE){
              IdpResponse response = IdpResponse.fromResultIntent(data);
              if (resultCode == RESULT_OK){
                  final FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
                  //Check if user exist on database
                  user_information.orderByKey()
                          .equalTo(firebaseUser.getUid())
                          .addListenerForSingleValueEvent(new ValueEventListener() {
                              @Override
                              public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                                  if (dataSnapshot.getValue() == null)    //If user is not exist
                                  {
                                      if (!dataSnapshot.child(firebaseUser.getUid()).exists()) //If key uid is not exist
                                      {
                                          Common.loggedUser = new User(firebaseUser.getUid(), firebaseUser.getEmail());       //--&gt; Error
                                          //Add to database
                                          user_information.child(Common.loggedUser.getUid())     //-&gt;Error
                                                  .setValue(Common.loggedUser);
                                  }
                              }
                                  else    // If user is available
                                  {
                                      Common.loggedUser = dataSnapshot.child(firebaseUser.getUid()).getValue(User.class);
                                  }
  
                                  // Save UID to storage to update location from background
                                  Paper.book().write(Common.USER_UID_SAVE_KEY, Common.loggedUser.getUid());     //-&gt;Error
                                  updateToken(firebaseUser);
                                  setupUI();
                              }
  
                              @Override
                              public void onCancelled(@NonNull DatabaseError databaseError) {
  
                              }
                          });
              }
          }
      }
  
      private void setupUI() {
          //Navigate Home
          startActivity(new Intent(MainActivity.this, HomeActivity.class));
      }
  
      private void updateToken(final FirebaseUser firebaseUser) {
          final DatabaseReference tokens = FirebaseDatabase.getInstance()
                  .getReference(Common.TOKENS);
  
          //Get Token
          FirebaseInstanceId.getInstance().getInstanceId()
                  .addOnSuccessListener(new OnSuccessListener&lt;InstanceIdResult&gt;() {
                      @Override
                      public void onSuccess(InstanceIdResult instanceIdResult) {
                          tokens.child(firebaseUser.getUid())
                                  .setValue(InstanceIdResult.getToken());    //-&gt;Error
                      }
                  }).addOnFailureListener(new OnFailureListener() {
              @Override
              public void onFailure(@NonNull Exception e) {
                  Toast.makeText(MainActivity.this, &quot;&quot;+e.getMessage(), Toast.LENGTH_SHORT).show();
              }
          });
      }
  }
  </code></pre>
  <p>Here is my User class</p>
  <pre><code>package com.mynewrealtimelocationtracker.Model;
  
  import java.util.HashMap;
  
  public class User {
      private String uid, email;
      private HashMap&lt;String, User&gt; acceptList;   //List user friend
  
      public User() {
      }
  
      public User(String uid, String email) {
          this.uid = uid;
          this.email = email;
          acceptList = new HashMap&lt;&gt;();
      }
  
      public String getUid() {
          return uid;
      }
  
      public void setUid(String uid) {
          this.uid = uid;
      }
  
      public String getEmail() {
          return email;
      }
  
      public void setEmail(String email) {
          this.email = email;
      }
  
      public HashMap&lt;String, User&gt; getAcceptList() {
          return acceptList;
      }
  
      public void setAcceptList(HashMap&lt;String, User&gt; acceptList) {
          this.acceptList = acceptList;
      }
  }
  </code></pre>