发现 属性 的两个 getter 或字段区分大小写冲突:image

Found two getters or fields with conflicting case sensitivity for property: image

我的 logcat 说是 "Found two getters or fields with conflicting case sensitivity for property : image"。我正在使用 firebase 数据库,我没有 child 命名为 "image" 而是我有一个 child 名称 "Image".

public class BlogCV {

public String Image;
public String Title;


public BlogCV() {
}

public BlogCV(String Image, String Title){
    this.Title = Title;
    this.Image = Image;
}

public String getImage() {
    return Image;
}

public String getTitle() {
    return Title;
}

}

您的 class 应如下所示:

public class BlogCV {
    public String image, title;

    public BlogCV() {}

    public BlogCV(String image, String title){
        this.image = image;
        this.title = title;
    }

    public String getImage() {
        return image;
    }

    public String getTitle() {
        return title;
    }
}

请查看现在以小写字母开头的字段。

使用其他库时,请确保遵循 Java 命名约定。您应该使用 camelCase 中的变量名称以小写字母开头。

你的问题不清楚。但我相信可以通过使用变量名称 imagestitle.

来解决