title: Class android.location.Location does not define a no-argument constructor
body: <p>I've been trying to simply push and read a class with two variables, a String and a Location, to firebase and I've been getting this error.</p>
  
  <pre><code>**com.google.firebase.database.DatabaseException: Class android.location.Location does not define a no-argument constructor. If you are using ProGuard, make sure these constructors are not stripped.
                                                                              at com.google.android.gms.internal.zzeas.zze(Unknown Source:51)
                                                                              at com.google.android.gms.internal.zzear.zzb(Unknown Source:772)
                                                                              at com.google.android.gms.internal.zzear.zza(Unknown Source:312)
                                                                              at com.google.android.gms.internal.zzear.zzb(Unknown Source:0)
                                                                              at com.google.android.gms.internal.zzeas.zze(Unknown Source:209)
                                                                              at com.google.android.gms.internal.zzear.zzb(Unknown Source:772)
                                                                              at com.google.android.gms.internal.zzear.zza(Unknown Source:0)
                                                                              at com.google.firebase.database.DataSnapshot.getValue(Unknown Source:10)
                                                                              at com.example.vish.mcapp.Selection$2$1.onDataChange(Selection.java:85)
                                                                              at com.google.firebase.database.zzp.onDataChange(Unknown Source:7)
                                                                              at com.google.android.gms.internal.zzduz.zza(Unknown Source:13)
                                                                              at com.google.android.gms.internal.zzdwu.zzbvb(Unknown Source:2)
                                                                              at com.google.android.gms.internal.zzdxa.run(Unknown Source:65)
                                                                              at android.os.Handler.handleCallback(Handler.java:790)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                              at android.os.Looper.loop(Looper.java:164)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:6494)
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)**
  </code></pre>
  
  <p>The class whose object I'm trying to push and read from firebase is below. </p>
  
  <pre><code>public class DeviceDetails {
     String nickname;
     Location location = new Location("Test");
  
      DeviceDetails()
       {
       }
  
       DeviceDetails(String nickname)
       {
       this.nickname = nickname;
       location.setLatitude(0.0);
       location.setLongitude(0.0);
       location.setTime(new Date().getTime());
       }
  
       DeviceDetails(String nickname, Location l)
       {
         this.nickname = nickname;
         location=l;
  }
  
  }
  </code></pre>
  
  <p>Pushing data into the Firebase works just fine. But I can't read it without running into the error above.</p>
  
  <p>Code I've written for writing into firebase is : - </p>
  
  <pre><code>register.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
  
              if(TextUtils.isEmpty(nickname.getText().toString()))
              {
                  Toast.makeText(Selection.this, "Nickname can't be empty", Toast.LENGTH_SHORT).show();
                  return;
              }
              else
              {
                  Location loc = new Location("");
                  loc.setLatitude(19.0);
                  loc.setLongitude(29.5);
                  loc.setTime(new Date().getTime());
                  DeviceDetails newDevice = new DeviceDetails(nickname.getText().toString(), loc);
                  mDatabase.child("Phones").child(nickname.getText().toString().trim().replaceAll("\\s","")).setValue(newDevice);
              }
  
  
          }
      });
  </code></pre>
  
  <p>Code I've written for reading from the Firebase and which I believe is the culprit is: - </p>
  
  <pre><code>retrieve.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
  
              DatabaseReference database = FirebaseDatabase.getInstance().getReference();
              DatabaseReference myRef = database.child("Phones");
              myRef.child(nickToRetrieve.getText().toString().trim().replaceAll("\\s", "")).addListenerForSingleValueEvent(new ValueEventListener() {
                  @Override
                  public void onDataChange(DataSnapshot dataSnapshot) {
                      DeviceDetails dev = dataSnapshot.getValue(DeviceDetails.class);
                      double latitude = dev.location.getLatitude();
                      double longitude = dev.location.getLongitude();
                      String loc = "Latitude - " + latitude + " Longitude - " + longitude;
                      Toast.makeText(Selection.this, loc, Toast.LENGTH_LONG).show();
                  }
  
                  @Override
                  public void onCancelled(DatabaseError databaseError) {
  
                  }
              });
  </code></pre>
  
  <p>Any help is greatly appreciated. </p>