Found two getters or fields with conflicting case sensitivity for property

前端 未结 6 1509
陌清茗
陌清茗 2020-12-20 17:08

Can anyone check if there are errors in it because I always get an error

com.google.firebase.database.DatabaseException: Found two getters or fields

6条回答
  •  春和景丽
    2020-12-20 17:41

    The Firebase JSON serialization name is controlled by the annotation PropertyName, if the name starts with a capital letter. You have two options

    1) Complain to complain
    2) use @PropertyName("Complain")

    public class Order implements Serializable {
    
    private String Complain;
    
    public Order() {
     Complain = "";
    }
    
    @PropertyName("Complain")
    public String getComplain() {
        return Complain;
    }
    
    @PropertyName("Complain")
    public void setComplain(String complain) {
        Complain = complain;
    }
    

    }

    reference https://stackoverflow.com/a/45809982/9315431

提交回复
热议问题