title: Firebase Cloud Firestore freezes app on insert
body: <p>I'm facing a strange problem. When I try to add data to my database, the app completely freezes. I've debugged the Firestore routines, and it seems to get stucked on the <code>add(Object)</code> method.</p>
  
  <p>This is the code wich from I call to insert the data:</p>
  
  <pre><code>public void addArmaOficial(Arma data) {
          if (data != null)
              db.collection(Constants.COLLECTION_BASE)
                      .document(Constants.COLLECTION_ARMAS)
                      .collection(Constants.COLLECTION_OFIARM)
                      .add(data)   ///&lt; It get's stucked here
                      .addOnSuccessListener(new OnSuccessListener&lt;DocumentReference&gt;() {
                          @Override
                          public void onSuccess(DocumentReference documentReference) {
                              Toast.makeText(ctx, R.string.accionexistosa, Toast.LENGTH_SHORT).show();
                              ctx.finish();
                          }
                      })
                      .addOnCompleteListener(new OnCompleteListener&lt;DocumentReference&gt;() {
                          @Override
                          public void onComplete(@NonNull Task&lt;DocumentReference&gt; task) {
                              Toast.makeText(ctx, R.string.addarmaoficialtoast, Toast.LENGTH_SHORT).show();
                          }
                      })
                      .addOnFailureListener(new OnFailureListener() {
                          @Override
                          public void onFailure(@NonNull Exception e) {
                              e.printStackTrace();
                          }
                      });
          else
              Toast.makeText(ctx, "Los datos son nulos", Toast.LENGTH_SHORT).show();
      }
  </code></pre>
  
  <p>I don't understand why this is happening. There's a little extract of the class "Arma":</p>
  
  <pre><code>public class Arma extends Equipo implements Parcelable {
      private String dano;
      private String tipo_dano;
      private ArrayList&lt;Prop_Arma&gt; propiedades;
      private String categoria_princ;
      private String categoria_secun;
      private String notas;
      private float distancaimed, distanciamax;
      private int mods;
  ///&lt; Constructor, getters and setters, and parcelable implementation done automatically
  }
  </code></pre>
  
  <p>And the "Prop_Arma" class:</p>
  
  <pre><code>public class Prop_Arma implements Parcelable {
      private String nombre;
      private boolean dano_var;
      private String descripcion;
      private boolean distancia;
      private boolean grande, muygrande, gigante, gargantuesca;
  ///&lt; The same as previous, constructors, getters and setters, and the Parcelable implementation done automatically
  }
  </code></pre>
  
  <p>The thing is that it gets stucked and say no error. Is like is running something, but I don't know what. Also, i've done the timestamps update in my code, so I don't think that could be the problem.</p>
  
  <h2>UPDATE 1</h2>
  
  <p>This is the code from where it's been called the method <code>addArmaOficial(Arma data)</code>:</p>
  
  <pre><code>public void Guardar(boolean flag) {
          if (arma_nueva.getPropiedades() == null &amp;&amp; !flag) {
              AlertDialog.Builder builder = new AlertDialog.Builder(this);
              builder.setMessage(R.string.nopropmessage)
                      .setTitle(R.string.nopropmesstit);
  
              builder.setNegativeButton(R.string.cancelar, new DialogInterface.OnClickListener() {
                          @Override
                          public void onClick(DialogInterface dialogInterface, int i) {
                              Toast.makeText(CrearArma.this, "Operación cancelada...", Toast.LENGTH_SHORT).show();
                          }
                      })
                      .setPositiveButton(R.string.continuar, new DialogInterface.OnClickListener() {
                          @Override
                          public void onClick(DialogInterface dialogInterface, int i) {
                              Guardar(true);
                          }
                      });
  
              AlertDialog dialog = builder.create();
              dialog.show();
          } else {
              arma_nueva.setNombre(((EditText) findViewById(R.id.nombre)).getText().toString());
              if(!Objects.equals(((EditText) findViewById(R.id.peso)).getText().toString(), ""))
                  arma_nueva.setPeso(Float.parseFloat(((EditText) findViewById(R.id.peso)).getText().toString()));
              if(!Objects.equals(((EditText) findViewById(R.id.costePC)).getText().toString(), ""))
                  arma_nueva.setPc(Integer.parseInt(((EditText) findViewById(R.id.costePC)).getText().toString()));
              if(!Objects.equals(((EditText) findViewById(R.id.costePP)).getText().toString(), ""))
                  arma_nueva.setPp(Integer.parseInt(((EditText) findViewById(R.id.costePP)).getText().toString()));
              if(!Objects.equals(((EditText) findViewById(R.id.costePO)).getText().toString(), ""))
                  arma_nueva.setPo(Integer.parseInt(((EditText) findViewById(R.id.costePO)).getText().toString()));
              arma_nueva.setDano(((Spinner)findViewById(R.id.dano)).getSelectedItem().toString());
              arma_nueva.setTipo_dano(tip_dano_spin.getSelectedItem().toString());
              arma_nueva.setCategoria_princ(cats_spin.getSelectedItem().toString());
              arma_nueva.setCategoria_secun(tips_spin.getSelectedItem().toString());
              if(!Objects.equals(((EditText) findViewById(R.id.distmed)).getText().toString(), ""))
                  arma_nueva.setDistancaimed(Float.parseFloat(((EditText)findViewById(R.id.distmed)).getText().toString()));
              if(!Objects.equals(((EditText) findViewById(R.id.distmax)).getText().toString(), ""))
                  arma_nueva.setDistanciamax(Float.parseFloat(((EditText)findViewById(R.id.distmax)).getText().toString()));
              if(!Objects.equals(((EditText) findViewById(R.id.mods)).getText().toString(), ""))
                  arma_nueva.setMods(Integer.parseInt(((EditText)findViewById(R.id.mods)).getText().toString()));
              DBConnector db = new DBConnector(this);
              db.addArmaOficial(arma_nueva);
          }
      }
  </code></pre>
  
  <p>This is inside a class declared as:</p>
  
  <pre><code>public class CrearArma extends AppCompatActivity {
  ///...
  }
  </code></pre>