title: NoSuchMethodError in Fragment with Cardview and RecyclerView connected to Firebase
body: <p>I am trying to create an incident reporting app where it is connected to firebase and whenever I create an incident in the application it will show up in the Firebase Database as well as in the form of Cardview and RecyclerView in the app itself. My app can already show the output in Firebase and now I am trying to get the CardView and RecyclerView done. </p>
  
  <p>However, when I run my application now, whenever I try to click on the fragment that allows me to input incidents, the application crashes and displays this error:</p>
  
  <blockquote>
    <p>java.lang.NoSuchMethodError: No virtual method zzbox()Z in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/com.example.samuel.a4-CppiMKcbuMktQgH7RUO1XA==/split_lib_dependencies_apk.apk)</p>
  </blockquote>
  
  <p>The supposed error is this line in my fragment: </p>
  
  <pre><code>mDatabase = FirebaseDatabase.getInstance().getReference().child("Incidents");
  </code></pre>
  
  <p>Keep in mind this is in a fragment and the tutorial that I watched was in a normal class.</p>
  
  <p>Here is the fragment from where I am inputting my incidents into</p>
  
  <pre><code>package com.example.samuel.a4;
  
  import android.content.Intent;
  import android.os.Bundle;
  import android.support.annotation.NonNull;
  import android.support.annotation.Nullable;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentTransaction;
  import android.support.v7.widget.LinearLayoutManager;
  import android.support.v7.widget.RecyclerView;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.Button;
  import android.widget.Spinner;
  import android.widget.TextView;
  import android.widget.Toast;
  import android.widget.Toolbar;
  
  import com.firebase.ui.database.FirebaseRecyclerAdapter;
  import com.github.clans.fab.FloatingActionButton;
  import com.github.clans.fab.FloatingActionMenu;
  import com.google.firebase.database.DatabaseReference;
  import com.google.firebase.database.FirebaseDatabase;
  
  import org.w3c.dom.Text;
  
  
  public class IncmanFragment extends Fragment {
  
  private RecyclerView mBlogList;
  private DatabaseReference mDatabase;
  
  FloatingActionButton fab;
  
  @Nullable
  @Override
  public View onCreateView(@NonNull LayoutInflater inflater, @Nullable 
  ViewGroup container, @Nullable Bundle savedInstanceState) {
  //        return inflater.inflate(R.layout.fragment_incman, container, 
  false);
       //i moved this up from just ontop of fab to here
      View myView = inflater.inflate(R.layout.fragment_incman, container, 
  false);
     // getFragmentManager().findFragmentById(R.id.fragment_container);
      mDatabase = 
  FirebaseDatabase.getInstance().getReference().child("Incidents");
      mDatabase.keepSynced(true);
  
      mBlogList=(RecyclerView) myView.findViewById(R.id.recyclerview);
      mBlogList.setHasFixedSize(true);
      mBlogList.setLayoutManager(new LinearLayoutManager(getActivity()));
  
  
      fab = (FloatingActionButton) myView.findViewById(R.id.fabIncident);
      fab.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              FragmentTransaction fragmentTransaction = 
  getFragmentManager().beginTransaction();
              fragmentTransaction.replace(R.id.fragment_container, new 
  ReportFragment());
              fragmentTransaction.addToBackStack(null);
            /*  Toast.makeText(getActivity(), "toast successful", 
  Toast.LENGTH_SHORT).show();*/
              fragmentTransaction.commit();
  
          }
  
      });
  
      return myView;
  }
  
  @Override
  public void onStart() {
      super.onStart();
      FirebaseRecyclerAdapter&lt;IncmanFirebaseName, IncmanViewHolder&gt; 
      firebaseRecyclerAdapter = new 
      FirebaseRecyclerAdapter&lt;IncmanFirebaseName, 
      IncmanViewHolder&gt;
              (IncmanFirebaseName.class, R.layout.incidentdesign, 
        IncmanViewHolder.class, mDatabase) {
          @Override
          protected void populateViewHolder(IncmanViewHolder viewHolder, 
  
              viewHolder.setTitle(model.getTitle());
              viewHolder.setDetails(model.getDetailsId());
              viewHolder.setRemarks(model.getRemarksId());
              viewHolder.setLocation(model.getLocationId());
              viewHolder.setDate(model.getDate());
              viewHolder.setUrgency(model.getUrgencyId());
  
          }
      };
  
      mBlogList.setAdapter(firebaseRecyclerAdapter);
  
  }
  
      public static class IncmanViewHolder extends RecyclerView.ViewHolder
      {
          View mView;
          public IncmanViewHolder(View itemView)
          {
              super(itemView);
              mView = itemView;
          }
          public void setTitle(String title)
          {
              TextView tvtitledesign = 
      (TextView)mView.findViewById(R.id.tvtitledesign);
              tvtitledesign.setText(title);
          }
          public void setDetails(String detailsId)
          {
              TextView tvdetailsdesign = 
      (TextView)mView.findViewById(R.id.tvdetailsdesign);
              tvdetailsdesign.setText(detailsId);
          }
          public void setRemarks(String remarksId)
          {
              TextView tvremarksdesign = 
      (TextView)mView.findViewById(R.id.tvremarksdesign);
              tvremarksdesign.setText(remarksId);
          }
          public void setLocation(String locationId)
          {
              TextView tvlocationdesign = (TextView) 
      mView.findViewById(R.id.tvlocationdesign);
              tvlocationdesign.setText(locationId);
  
          }
          public void setDate (String date)
          {
              TextView tvdatedesign = 
       (TextView)mView.findViewById(R.id.tvdatedesign);
              tvdatedesign.setText(date);
          }
          public void setUrgency(String urgencyId)
          {
              TextView tvurgencydesign = 
       (TextView)mView.findViewById(R.id.tvurgencydesign);
              tvurgencydesign.setText(urgencyId);
          }
      }
  }
  </code></pre>
  
  <p>This is the class where the constructor and get and set methods are</p>
  
  <pre><code> package com.example.samuel.a4;
  
      public class IncmanFirebaseName {
  
      private String date;
      private String detailsId;
      private String locationId;
      private String remarksId;
      private String reportedById;
      private String splocationId;
      private String typeId;
      private String urgencyId;
      private String title;
  
      public IncmanFirebaseName(String date, String detailsId, String 
      remarksId/*String reportedById*/ /* String typeId*/, String urgencyId, 
      String 
      title) {
          this.date = date;
          this.detailsId = detailsId;
        /*  this.locationId = locationId;*/
          this.remarksId = remarksId;
          /*this.reportedById = reportedById;*/
          this.splocationId = splocationId;
          /*this.typeId = typeId;*/
          this.urgencyId = urgencyId;
          this.title=title;
      }
  
      public String getDate() {
          return date;
      }
  
      public void setDate(String date) {
          this.date = date;
      }
  
      public String getDetailsId() {
          return detailsId;
      }
  
      public void setDetailsId(String detailsId) {
          this.detailsId = detailsId;
      }
  
      public String getLocationId() {
          return locationId;
      }
  
      public void setLocationId(String locationId) {
          this.locationId = locationId;
      }
  
      public String getRemarksId() {
          return remarksId;
      }
  
      public void setRemarksId(String remarksId) {
          this.remarksId = remarksId;
      }
  
      /*public String getReportedById() {
          return reportedById;
      }
  
      public void setReportedById(String reportedById) {
          this.reportedById = reportedById;
      }*/
  
      /* public String getSplocationId() {
          return splocationId;
      }
  
      public void setSplocationId(String splocationId) {
          this.splocationId = splocationId;
      }*/
  
       /*   public String getTypeId() {
          return typeId;
      }
  
      public void setTypeId(String typeId) {
          this.typeId = typeId;
      }*/
  
      public String getUrgencyId() {
          return urgencyId;
      }
  
      public void setUrgencyId(String urgencyId) {
          this.urgencyId = urgencyId;
      }
  
      public String getTitle(){
          return title;
      }
      public void setTitle() {
          this.title = title;
      }
      public IncmanFirebaseName()
      {
  
      }
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/RIugG.png" rel="nofollow noreferrer">Database Structure</a></p>
  
  <p>Now I am not sure why the logcat shows that line as an error in my code because I have a similar line in another fragment and it is working perfectly fine; here is the fragment: " package com.example.samuel.a4;</p>
  
  <pre><code>    import android.app.DatePickerDialog;
      import android.app.ProgressDialog;
      import android.content.Intent;
      import android.graphics.Bitmap;
      import android.graphics.Color;
      import android.graphics.drawable.ColorDrawable;
      import android.media.Image;
      import android.net.Uri;
      import android.os.Bundle;
      import android.provider.MediaStore;
      import android.support.annotation.NonNull;
      import android.support.annotation.Nullable;
      import android.support.v4.app.Fragment;
      import android.text.TextUtils;
      import android.view.LayoutInflater;
      import android.view.View;
      import android.view.ViewGroup;
      import android.widget.AdapterView;
      import android.widget.ArrayAdapter;
      import android.widget.Button;
      import android.widget.DatePicker;
      import android.widget.EditText;
      import android.widget.ImageView;
      import android.widget.Spinner;
      import android.widget.TextView;
      import android.widget.Toast;
  
      import com.google.android.gms.tasks.OnCompleteListener;
      import com.google.android.gms.tasks.OnFailureListener;
      import com.google.android.gms.tasks.OnSuccessListener;
      import com.google.android.gms.tasks.Task;
      import com.google.firebase.database.DatabaseReference;
      import com.google.firebase.database.FirebaseDatabase;
      import com.google.firebase.storage.FirebaseStorage;
      import com.google.firebase.storage.OnProgressListener;
      import com.google.firebase.storage.StorageReference;
      import com.google.firebase.storage.UploadTask;
  
      import org.w3c.dom.Text;
  
      import java.io.IOException;
      import java.util.Calendar;
      import java.util.Date;
      import java.util.UUID;
  
      import static android.app.Activity.RESULT_OK;
  
      public class ReportFragment extends Fragment implements 
      AdapterView.OnItemSelectedListener{
  
      private Button btnChoose,btnUpload;
      private ImageView imageView;
      private Uri filePath;
      private final int PICK_IMAGE_REQUEST = 71;
      private TextView mDisplayDate;
      private DatePickerDialog.OnDateSetListener mDateSetListener;
  
      private EditText reportedBy;
      private TextView date; //upstairs declare alr as mDisplayDate
      private Spinner spinner; //downstairs declare alr as spinner3
      private EditText location;
      private Spinner spinner2; //downstairs declare alr as spinner2
      private EditText details;
      private Spinner spinner3; //downstairs declare alr as spinner1
      private EditText remarks;
      private EditText title;
      private Button submitIncident;
  
      DatabaseReference databaseIncidents;
      FirebaseStorage storage;
      StorageReference storageReference;
  
      @Nullable
      @Override
      public View onCreateView(@NonNull LayoutInflater inflater, @Nullable 
      ViewGroup container, @Nullable Bundle savedInstanceState) {
          View v = inflater.inflate(R.layout.fragment_report, container, 
  false);
  
            databaseIncidents = 
      FirebaseDatabase.getInstance().getReference("Incidents");
          storage = FirebaseStorage.getInstance();
          storageReference = storage.getReference();
  
          btnChoose = (Button) v.findViewById(R.id.btnChoose);
          btnUpload = (Button) v.findViewById(R.id.btnUpload);
          imageView = (ImageView) v.findViewById(R.id.imgView);
  
          reportedBy = (EditText) v.findViewById(R.id.etreportedby);
      //        Below have already line 151
      //        date = (TextView) v.findViewById(R.id.tvdate);
          location = (EditText) v.findViewById(R.id.etlocation);
          details = (EditText) v.findViewById(R.id.etdetails);
          remarks = (EditText) v.findViewById(R.id.etremarks);
          title = (EditText) v.findViewById(R.id.ettitle);
          submitIncident = (Button) v.findViewById(R.id.btnSubmit);
  
  
          btnChoose.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  chooseImage();
              }
          });
          btnUpload.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  uploadImage();
              }
          });
  
          submitIncident.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  incidentSubmit();
              }
          });
  
          return v;
  
  
      }
  
      private void incidentSubmit(){
          String reportedname = reportedBy.getText().toString().trim();
          String location1 = location.getText().toString();
          String details1 = details.getText().toString();
          String remarks1 = remarks.getText().toString();
          String urgency1 = spinner.getSelectedItem().toString();
          String type1 = spinner2.getSelectedItem().toString();
          String splocation1 = spinner3.getSelectedItem().toString();
          String date1 = mDisplayDate.getText().toString();
          String title1 = title.getText().toString();
  
          if(!TextUtils.isEmpty(reportedname)) {
  
              String incidentId = databaseIncidents.push().getKey();
              Incident incident = new 
  
    Incident(reportedname,location1,details1,remarks1,urgency1,type1,splocation1,date1,title1);
              databaseIncidents.child(incidentId).setValue(incident);
  
              Toast.makeText(getActivity(), "Incident Added", 
      Toast.LENGTH_LONG).show();
          } else {
              Toast.makeText(getActivity(), "All fields must be 
      entered",Toast.LENGTH_LONG).show();
          }
  
      }
  
  
      @Override
      public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, 
      long id) {
          String text = parent.getItemAtPosition(position).toString();
          Toast.makeText(parent.getContext(), text, Toast.LENGTH_SHORT).show();
      }
  
      @Override
      public void onNothingSelected(AdapterView&lt;?&gt; parent) {
  
      }
  
      }
  </code></pre>
  
  <p>Any help is sincerely appreciated. Thank you!</p>