Every time I try to retrieve data from my database, I get
com.google.firebase.database.DatabaseException: Found two getters or fields with conflicting case s
I found a different solution to keep my field public String id
and at the same time have the method public String getId()
which I needed to implement because of an interface: Simply mark the method with @Exclude
, e.g.:
public class Group implements Identifiable<String>
{
public String id;
protected Group ()
{
}
public Group ( String id )
{
this.id = id;
}
@Exclude
@Override
public String getId ()
{
return id;
}
}
Convert the following fields from public to private
public int K;
public double L;
public int D;
public int N;
to
private int K;
private double L;
private int D;
private int N;
The Firebase Database consider these items when serializing/deserializing JSON:
Since you have both a public field N
and getN()
/setN()
methods, it considers the two in conflict. While in this case setting N
and calling setN()
leads to the same result, that may not always be the case. The chance of getting it wrong is too big, which is why the scenario is simply not allowed.
The error message is a bit of a red herring in this case. We should improve that.