title: Encapsulated getters refurn null from firebase database only in release. Works fine in debug mode
body: <p>The app works fine in debug mode, but when i compile in release and upload to play store, the encapsulated getters return null.
  The snapshot has data, but getter are returning null.</p>
  
  <p>Anyone has any idea why this happens ?</p>
  
  <p>Firebase database :</p>
  
  <p><img src="https://i.stack.imgur.com/zWFXs.png" alt="Firebase database"></p>
  
  <p>Encapsulated getter:</p>
  
  <pre><code>import com.google.firebase.database.Exclude;
  import com.google.firebase.database.IgnoreExtraProperties;
  
  import java.util.HashMap;
  import java.util.Map;
  
  @IgnoreExtraProperties
  public class Posto {
  
      public String uid;
      public String nome;
      public String publico;
      public String status;
      public double latitude;
      public double longitude;
      public int bandeira;
      public String cep;
      public String logradouro;
      public String numero;
      public String bairro;
      public String cidade;
      public String estado;
      public String telefone;
      public double valor = 0.000;
      public int starCount = 0;
      public Map&lt;String, Boolean&gt; stars = new HashMap&lt;&gt;();
  
      public Posto() {
          // Default constructor required for calls to DataSnapshot.getValue(Posto.class)
      }
  
      public Posto(String uid, String nome, String publico, String status, Double latitude,
                   Double longitude, int bandeira, String cep, String logradouro, String numero,
                   String bairro, String cidade, String estado, String telefone, Double valor) {
          this.uid = uid;
          this.nome = nome;
          this.publico = publico;
          this.status = status;
          this.latitude = latitude;
          this.longitude = longitude;
          this.bandeira = bandeira;
          this.cep = cep;
          this.logradouro = logradouro;
          this.numero = numero;
          this.bairro = bairro;
          this.cidade = cidade;
          this.estado = estado;
          this.telefone = telefone;
          this.valor = valor;
      }
  
      // [START post_to_map]
      @Exclude
      public Map&lt;String, Object&gt; toMap() {
          HashMap&lt;String, Object&gt; result = new HashMap&lt;&gt;();
          result.put("uid", uid);
          result.put("nome", nome);
          result.put("publico", publico);
          result.put("status", status);
          result.put("latitude", latitude);
          result.put("longitude", longitude);
          result.put("bandeira", bandeira);
          result.put("cep", cep);
          result.put("logradouro", logradouro);
          result.put("numero", numero);
          result.put("bairro", bairro);
          result.put("cidade", cidade);
          result.put("estado", estado);
          result.put("telefone", telefone);
          result.put("valor", valor);
          result.put("starCount", starCount);
          result.put("stars", stars);
  
          return result;
      }
      // [END post_to_map]
  
  }
  // [END post_class]
  </code></pre>
  
  <p>and there:</p>
  
  <pre><code>    public void CarregaMarcNuvem() {
          showProgressDialog();
  
          mPostosDBRef.addListenerForSingleValueEvent(new ValueEventListener() {
              public void onDataChange(DataSnapshot dataSnapshot) {
                  // Limpa os marcadores do mapa e zera a matriz identificadora de marcadores
                  mMap.clear();
                  mHashMap.clear();
  
                  Log.d(TAG,"dataSnapshot: "+dataSnapshot);
  
                  for (DataSnapshot postSnapshot: dataSnapshot.getChildren()) {
                      mPostoKey = postSnapshot.getKey();
                      Posto posto = postSnapshot.getValue(Posto.class);
  
                      Log.d(TAG,"postSnapshot: "+postSnapshot);
  
                      mLatitude = posto.latitude;
                      mLongitude = posto.longitude;
                      mValor = posto.valor;
                      mNome = posto.nome;
                      mLogradouro = posto.logradouro;
                      mNumero = posto.numero;
                      mCidade = posto.cidade;
  
  // .... SOME TREATMENT OF DATA ....
  
                      mClusterManager.addItem(offsetItem);
                      mHashMap.put(offsetItem, postSnapshot.getKey());
                  }
                  mClusterManager.cluster();
                  hideProgressDialog();
                  try {
                      GravaHashMap();
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              }
  
              @Override
              public void onCancelled(DatabaseError databaseError) {
                  System.out.println("****** The read failed: " + databaseError.getCode());
              }
          });
      }
  </code></pre>
  
  <p>dataSnapshot and postSnapshot has data from database OK, but in getter <strong>posto</strong> not.</p>
  
  <p><strong>posto.latitude</strong> and all return null only in release mode. In debug mode, works fine.</p>
  
  <p>I really dont know what to do.
  Please, any idea ?</p>
  
  <p><strong>=== SOLVED ===</strong></p>
  
  <p>Include forward line in <strong>dependencies</strong> of <strong>build.graddle</strong> :</p>
  
  <p>" <strong>compile 'com.android.support:support-annotations:25.2.0'</strong> "</p>
  
  <p>Add " <strong>@Keep</strong> " after <strong>public class Posto {</strong>, like this :</p>
  
  <pre><code>...
  @IgnoreExtraProperties
  @Keep
  public class Posto {
      public String uid;
      public String nome;
  ...
  </code></pre>
  
  <p>Thanks for Frank Van Puffelen</p>