Build error : Cannot find getter for field
Build error : Cannot find getter for field
我正在尝试通过 android 应用程序为 RoomDB 创建一个实体。我正在使用 AndroidX。
可以在没有任何运行时错误的情况下创建实体。但是为返回 Cannot find getter for field 错误的实体给出编译时错误。
这是实体,
package com.example.model;
import androidx.annotation.NonNull;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
import java.io.Serializable;
@Entity
public class ItemMaster implements Serializable {
@PrimaryKey
@NonNull
private String itemCode;
private String mCode;
private String invItem;
private Boolean act;
private String fb;
private String text_;
private String dept;
private String cat;
private String textSht;
private String depNo;
private String subDep;
private String locked;
private String mec;
private String taxFlag;
private Integer kitchPno;
private String kitchPrn;
private String spec;
private Integer slips;
private Boolean allIncl;
private Double priceUsd;
private Double exchRate;
private Double price1Nw;
private Double price1Nt;
private Double price1;
private Double price2Nw;
private Double price2Nt;
private Double price2;
private Double price3Nw;
private Double price3Nt;
private Double price3;
private Double price4Nw;
private Double price4Nt;
private Double price4;
private Double price5Nw;
private Double price5Nt;
private Double price5;
private Double price6Nw;
private Double price6Nt;
private Double price6;
private Double price7Nw;
private Double price7Nt;
private Double price7;
private Double price8Nw;
private Double price8Nt;
private Double price8;
private Double price9Nw;
private Double price9Nt;
private Double price9;
private Double price10Nw;
private Double price10Nt;
private Double price10;
private String posgF2;
private Double costP;
private String posgFlag;
private String openItem;
private String happyFlag;
private Integer oneToOne;
private Double cnt;
private Double tod;
private Double mtd;
private Double ytd;
private Double daySale;
private Double opnStk;
private Double opnStk2;
private Double opnStk3;
private Double prvOpnStk;
private Double prvOpnBev;
private Double opnBev;
private Double bevIn;
private Double bevOut;
private Double daySaleBev;
private Double wastage;
private String itRem;
private String add1;
private String add2;
private String add3;
private String add4;
private Integer id_;
private Integer toucol;
@NonNull
public String getItemCode() {
return itemCode;
}
public void setItemCode(@NonNull String itemCode) {
this.itemCode = itemCode;
}
public String getmCode() {
return mCode;
}
public void setmCode(String mCode) {
this.mCode = mCode;
}
public String getInvItem() {
return invItem;
}
public void setInvItem(String invItem) {
this.invItem = invItem;
}
public Boolean getAct() {
return act;
}
public void setAct(Boolean act) {
this.act = act;
}
public String getFb() {
return fb;
}
public void setFb(String fb) {
this.fb = fb;
}
public String getDept() {
return dept;
}
public void setDept(String dept) {
this.dept = dept;
}
public String getCat() {
return cat;
}
public void setCat(String cat) {
this.cat = cat;
}
public String getTextSht() {
return textSht;
}
public void setTextSht(String textSht) {
this.textSht = textSht;
}
public String getDepNo() {
return depNo;
}
public void setDepNo(String depNo) {
this.depNo = depNo;
}
public String getSubDep() {
return subDep;
}
public void setSubDep(String subDep) {
this.subDep = subDep;
}
public String getLocked() {
return locked;
}
public void setLocked(String locked) {
this.locked = locked;
}
public String getMec() {
return mec;
}
public void setMec(String mec) {
this.mec = mec;
}
public String getTaxFlag() {
return taxFlag;
}
public void setTaxFlag(String taxFlag) {
this.taxFlag = taxFlag;
}
public Integer getKitchPno() {
return kitchPno;
}
public void setKitchPno(Integer kitchPno) {
this.kitchPno = kitchPno;
}
public String getKitchPrn() {
return kitchPrn;
}
public void setKitchPrn(String kitchPrn) {
this.kitchPrn = kitchPrn;
}
public String getSpec() {
return spec;
}
public void setSpec(String spec) {
this.spec = spec;
}
public Integer getSlips() {
return slips;
}
public void setSlips(Integer slips) {
this.slips = slips;
}
public Boolean getAllIncl() {
return allIncl;
}
public void setAllIncl(Boolean allIncl) {
this.allIncl = allIncl;
}
public Double getPriceUsd() {
return priceUsd;
}
public void setPriceUsd(Double priceUsd) {
this.priceUsd = priceUsd;
}
public Double getExchRate() {
return exchRate;
}
public void setExchRate(Double exchRate) {
this.exchRate = exchRate;
}
public Double getPrice1Nw() {
return price1Nw;
}
public void setPrice1Nw(Double price1Nw) {
this.price1Nw = price1Nw;
}
public Double getPrice1Nt() {
return price1Nt;
}
public void setPrice1Nt(Double price1Nt) {
this.price1Nt = price1Nt;
}
public Double getPrice1() {
return price1;
}
public void setPrice1(Double price1) {
this.price1 = price1;
}
public Double getPrice2Nw() {
return price2Nw;
}
public void setPrice2Nw(Double price2Nw) {
this.price2Nw = price2Nw;
}
public Double getPrice2Nt() {
return price2Nt;
}
public void setPrice2Nt(Double price2Nt) {
this.price2Nt = price2Nt;
}
public Double getPrice2() {
return price2;
}
public void setPrice2(Double price2) {
this.price2 = price2;
}
public Double getPrice3Nw() {
return price3Nw;
}
public void setPrice3Nw(Double price3Nw) {
this.price3Nw = price3Nw;
}
public Double getPrice3Nt() {
return price3Nt;
}
public void setPrice3Nt(Double price3Nt) {
this.price3Nt = price3Nt;
}
public Double getPrice3() {
return price3;
}
public void setPrice3(Double price3) {
this.price3 = price3;
}
public Double getPrice4Nw() {
return price4Nw;
}
public void setPrice4Nw(Double price4Nw) {
this.price4Nw = price4Nw;
}
public Double getPrice4Nt() {
return price4Nt;
}
public void setPrice4Nt(Double price4Nt) {
this.price4Nt = price4Nt;
}
public Double getPrice4() {
return price4;
}
public void setPrice4(Double price4) {
this.price4 = price4;
}
public Double getPrice5Nw() {
return price5Nw;
}
public void setPrice5Nw(Double price5Nw) {
this.price5Nw = price5Nw;
}
public Double getPrice5Nt() {
return price5Nt;
}
public void setPrice5Nt(Double price5Nt) {
this.price5Nt = price5Nt;
}
public Double getPrice5() {
return price5;
}
public void setPrice5(Double price5) {
this.price5 = price5;
}
public Double getPrice6Nw() {
return price6Nw;
}
public void setPrice6Nw(Double price6Nw) {
this.price6Nw = price6Nw;
}
public Double getPrice6Nt() {
return price6Nt;
}
public void setPrice6Nt(Double price6Nt) {
this.price6Nt = price6Nt;
}
public Double getPrice6() {
return price6;
}
public void setPrice6(Double price6) {
this.price6 = price6;
}
public Double getPrice7Nw() {
return price7Nw;
}
public void setPrice7Nw(Double price7Nw) {
this.price7Nw = price7Nw;
}
public Double getPrice7Nt() {
return price7Nt;
}
public void setPrice7Nt(Double price7Nt) {
this.price7Nt = price7Nt;
}
public Double getPrice7() {
return price7;
}
public void setPrice7(Double price7) {
this.price7 = price7;
}
public Double getPrice8Nw() {
return price8Nw;
}
public void setPrice8Nw(Double price8Nw) {
this.price8Nw = price8Nw;
}
public Double getPrice8Nt() {
return price8Nt;
}
public void setPrice8Nt(Double price8Nt) {
this.price8Nt = price8Nt;
}
public Double getPrice8() {
return price8;
}
public void setPrice8(Double price8) {
this.price8 = price8;
}
public Double getPrice9Nw() {
return price9Nw;
}
public void setPrice9Nw(Double price9Nw) {
this.price9Nw = price9Nw;
}
public Double getPrice9Nt() {
return price9Nt;
}
public void setPrice9Nt(Double price9Nt) {
this.price9Nt = price9Nt;
}
public Double getPrice9() {
return price9;
}
public void setPrice9(Double price9) {
this.price9 = price9;
}
public Double getPrice10Nw() {
return price10Nw;
}
public void setPrice10Nw(Double price10Nw) {
this.price10Nw = price10Nw;
}
public Double getPrice10Nt() {
return price10Nt;
}
public void setPrice10Nt(Double price10Nt) {
this.price10Nt = price10Nt;
}
public Double getPrice10() {
return price10;
}
public void setPrice10(Double price10) {
this.price10 = price10;
}
public String getPosgF2() {
return posgF2;
}
public void setPosgF2(String posgF2) {
this.posgF2 = posgF2;
}
public Double getCostP() {
return costP;
}
public void setCostP(Double costP) {
this.costP = costP;
}
public String getPosgFlag() {
return posgFlag;
}
public void setPosgFlag(String posgFlag) {
this.posgFlag = posgFlag;
}
public String getOpenItem() {
return openItem;
}
public void setOpenItem(String openItem) {
this.openItem = openItem;
}
public String getHappyFlag() {
return happyFlag;
}
public void setHappyFlag(String happyFlag) {
this.happyFlag = happyFlag;
}
public Integer getOneToOne() {
return oneToOne;
}
public void setOneToOne(Integer oneToOne) {
this.oneToOne = oneToOne;
}
public Double getCnt() {
return cnt;
}
public void setCnt(Double cnt) {
this.cnt = cnt;
}
public Double getTod() {
return tod;
}
public void setTod(Double tod) {
this.tod = tod;
}
public Double getMtd() {
return mtd;
}
public void setMtd(Double mtd) {
this.mtd = mtd;
}
public Double getYtd() {
return ytd;
}
public void setYtd(Double ytd) {
this.ytd = ytd;
}
public Double getDaySale() {
return daySale;
}
public void setDaySale(Double daySale) {
this.daySale = daySale;
}
public Double getOpnStk() {
return opnStk;
}
public void setOpnStk(Double opnStk) {
this.opnStk = opnStk;
}
public Double getOpnStk2() {
return opnStk2;
}
public void setOpnStk2(Double opnStk2) {
this.opnStk2 = opnStk2;
}
public Double getOpnStk3() {
return opnStk3;
}
public void setOpnStk3(Double opnStk3) {
this.opnStk3 = opnStk3;
}
public Double getPrvOpnStk() {
return prvOpnStk;
}
public void setPrvOpnStk(Double prvOpnStk) {
this.prvOpnStk = prvOpnStk;
}
public Double getPrvOpnBev() {
return prvOpnBev;
}
public void setPrvOpnBev(Double prvOpnBev) {
this.prvOpnBev = prvOpnBev;
}
public Double getOpnBev() {
return opnBev;
}
public void setOpnBev(Double opnBev) {
this.opnBev = opnBev;
}
public Double getBevIn() {
return bevIn;
}
public void setBevIn(Double bevIn) {
this.bevIn = bevIn;
}
public Double getBevOut() {
return bevOut;
}
public void setBevOut(Double bevOut) {
this.bevOut = bevOut;
}
public Double getDaySaleBev() {
return daySaleBev;
}
public void setDaySaleBev(Double daySaleBev) {
this.daySaleBev = daySaleBev;
}
public Double getWastage() {
return wastage;
}
public void setWastage(Double wastage) {
this.wastage = wastage;
}
public String getItRem() {
return itRem;
}
public void setItRem(String itRem) {
this.itRem = itRem;
}
public String getAdd1() {
return add1;
}
public void setAdd1(String add1) {
this.add1 = add1;
}
public String getAdd2() {
return add2;
}
public void setAdd2(String add2) {
this.add2 = add2;
}
public String getAdd3() {
return add3;
}
public void setAdd3(String add3) {
this.add3 = add3;
}
public String getAdd4() {
return add4;
}
public void setAdd4(String add4) {
this.add4 = add4;
}
public Integer getToucol() {
return toucol;
}
public void setToucol(Integer toucol) {
this.toucol = toucol;
}
public String getText_() {
return text_;
}
public void setText_(String text_) {
this.text_ = text_;
}
public Integer getId_() {
return id_;
}
public void setId_(Integer id_) {
this.id_ = id_;
}
}
解决这个错误的正确方法是什么。
提前致谢。
您应该使用 @ColumnInfo(name = "yourcolumn")
注释命名以避免此类错误。
你的情况`
@ColumnInfo(name = "mcode")
public String mCode;
我正在尝试通过 android 应用程序为 RoomDB 创建一个实体。我正在使用 AndroidX。 可以在没有任何运行时错误的情况下创建实体。但是为返回 Cannot find getter for field 错误的实体给出编译时错误。
这是实体,
package com.example.model;
import androidx.annotation.NonNull;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
import java.io.Serializable;
@Entity
public class ItemMaster implements Serializable {
@PrimaryKey
@NonNull
private String itemCode;
private String mCode;
private String invItem;
private Boolean act;
private String fb;
private String text_;
private String dept;
private String cat;
private String textSht;
private String depNo;
private String subDep;
private String locked;
private String mec;
private String taxFlag;
private Integer kitchPno;
private String kitchPrn;
private String spec;
private Integer slips;
private Boolean allIncl;
private Double priceUsd;
private Double exchRate;
private Double price1Nw;
private Double price1Nt;
private Double price1;
private Double price2Nw;
private Double price2Nt;
private Double price2;
private Double price3Nw;
private Double price3Nt;
private Double price3;
private Double price4Nw;
private Double price4Nt;
private Double price4;
private Double price5Nw;
private Double price5Nt;
private Double price5;
private Double price6Nw;
private Double price6Nt;
private Double price6;
private Double price7Nw;
private Double price7Nt;
private Double price7;
private Double price8Nw;
private Double price8Nt;
private Double price8;
private Double price9Nw;
private Double price9Nt;
private Double price9;
private Double price10Nw;
private Double price10Nt;
private Double price10;
private String posgF2;
private Double costP;
private String posgFlag;
private String openItem;
private String happyFlag;
private Integer oneToOne;
private Double cnt;
private Double tod;
private Double mtd;
private Double ytd;
private Double daySale;
private Double opnStk;
private Double opnStk2;
private Double opnStk3;
private Double prvOpnStk;
private Double prvOpnBev;
private Double opnBev;
private Double bevIn;
private Double bevOut;
private Double daySaleBev;
private Double wastage;
private String itRem;
private String add1;
private String add2;
private String add3;
private String add4;
private Integer id_;
private Integer toucol;
@NonNull
public String getItemCode() {
return itemCode;
}
public void setItemCode(@NonNull String itemCode) {
this.itemCode = itemCode;
}
public String getmCode() {
return mCode;
}
public void setmCode(String mCode) {
this.mCode = mCode;
}
public String getInvItem() {
return invItem;
}
public void setInvItem(String invItem) {
this.invItem = invItem;
}
public Boolean getAct() {
return act;
}
public void setAct(Boolean act) {
this.act = act;
}
public String getFb() {
return fb;
}
public void setFb(String fb) {
this.fb = fb;
}
public String getDept() {
return dept;
}
public void setDept(String dept) {
this.dept = dept;
}
public String getCat() {
return cat;
}
public void setCat(String cat) {
this.cat = cat;
}
public String getTextSht() {
return textSht;
}
public void setTextSht(String textSht) {
this.textSht = textSht;
}
public String getDepNo() {
return depNo;
}
public void setDepNo(String depNo) {
this.depNo = depNo;
}
public String getSubDep() {
return subDep;
}
public void setSubDep(String subDep) {
this.subDep = subDep;
}
public String getLocked() {
return locked;
}
public void setLocked(String locked) {
this.locked = locked;
}
public String getMec() {
return mec;
}
public void setMec(String mec) {
this.mec = mec;
}
public String getTaxFlag() {
return taxFlag;
}
public void setTaxFlag(String taxFlag) {
this.taxFlag = taxFlag;
}
public Integer getKitchPno() {
return kitchPno;
}
public void setKitchPno(Integer kitchPno) {
this.kitchPno = kitchPno;
}
public String getKitchPrn() {
return kitchPrn;
}
public void setKitchPrn(String kitchPrn) {
this.kitchPrn = kitchPrn;
}
public String getSpec() {
return spec;
}
public void setSpec(String spec) {
this.spec = spec;
}
public Integer getSlips() {
return slips;
}
public void setSlips(Integer slips) {
this.slips = slips;
}
public Boolean getAllIncl() {
return allIncl;
}
public void setAllIncl(Boolean allIncl) {
this.allIncl = allIncl;
}
public Double getPriceUsd() {
return priceUsd;
}
public void setPriceUsd(Double priceUsd) {
this.priceUsd = priceUsd;
}
public Double getExchRate() {
return exchRate;
}
public void setExchRate(Double exchRate) {
this.exchRate = exchRate;
}
public Double getPrice1Nw() {
return price1Nw;
}
public void setPrice1Nw(Double price1Nw) {
this.price1Nw = price1Nw;
}
public Double getPrice1Nt() {
return price1Nt;
}
public void setPrice1Nt(Double price1Nt) {
this.price1Nt = price1Nt;
}
public Double getPrice1() {
return price1;
}
public void setPrice1(Double price1) {
this.price1 = price1;
}
public Double getPrice2Nw() {
return price2Nw;
}
public void setPrice2Nw(Double price2Nw) {
this.price2Nw = price2Nw;
}
public Double getPrice2Nt() {
return price2Nt;
}
public void setPrice2Nt(Double price2Nt) {
this.price2Nt = price2Nt;
}
public Double getPrice2() {
return price2;
}
public void setPrice2(Double price2) {
this.price2 = price2;
}
public Double getPrice3Nw() {
return price3Nw;
}
public void setPrice3Nw(Double price3Nw) {
this.price3Nw = price3Nw;
}
public Double getPrice3Nt() {
return price3Nt;
}
public void setPrice3Nt(Double price3Nt) {
this.price3Nt = price3Nt;
}
public Double getPrice3() {
return price3;
}
public void setPrice3(Double price3) {
this.price3 = price3;
}
public Double getPrice4Nw() {
return price4Nw;
}
public void setPrice4Nw(Double price4Nw) {
this.price4Nw = price4Nw;
}
public Double getPrice4Nt() {
return price4Nt;
}
public void setPrice4Nt(Double price4Nt) {
this.price4Nt = price4Nt;
}
public Double getPrice4() {
return price4;
}
public void setPrice4(Double price4) {
this.price4 = price4;
}
public Double getPrice5Nw() {
return price5Nw;
}
public void setPrice5Nw(Double price5Nw) {
this.price5Nw = price5Nw;
}
public Double getPrice5Nt() {
return price5Nt;
}
public void setPrice5Nt(Double price5Nt) {
this.price5Nt = price5Nt;
}
public Double getPrice5() {
return price5;
}
public void setPrice5(Double price5) {
this.price5 = price5;
}
public Double getPrice6Nw() {
return price6Nw;
}
public void setPrice6Nw(Double price6Nw) {
this.price6Nw = price6Nw;
}
public Double getPrice6Nt() {
return price6Nt;
}
public void setPrice6Nt(Double price6Nt) {
this.price6Nt = price6Nt;
}
public Double getPrice6() {
return price6;
}
public void setPrice6(Double price6) {
this.price6 = price6;
}
public Double getPrice7Nw() {
return price7Nw;
}
public void setPrice7Nw(Double price7Nw) {
this.price7Nw = price7Nw;
}
public Double getPrice7Nt() {
return price7Nt;
}
public void setPrice7Nt(Double price7Nt) {
this.price7Nt = price7Nt;
}
public Double getPrice7() {
return price7;
}
public void setPrice7(Double price7) {
this.price7 = price7;
}
public Double getPrice8Nw() {
return price8Nw;
}
public void setPrice8Nw(Double price8Nw) {
this.price8Nw = price8Nw;
}
public Double getPrice8Nt() {
return price8Nt;
}
public void setPrice8Nt(Double price8Nt) {
this.price8Nt = price8Nt;
}
public Double getPrice8() {
return price8;
}
public void setPrice8(Double price8) {
this.price8 = price8;
}
public Double getPrice9Nw() {
return price9Nw;
}
public void setPrice9Nw(Double price9Nw) {
this.price9Nw = price9Nw;
}
public Double getPrice9Nt() {
return price9Nt;
}
public void setPrice9Nt(Double price9Nt) {
this.price9Nt = price9Nt;
}
public Double getPrice9() {
return price9;
}
public void setPrice9(Double price9) {
this.price9 = price9;
}
public Double getPrice10Nw() {
return price10Nw;
}
public void setPrice10Nw(Double price10Nw) {
this.price10Nw = price10Nw;
}
public Double getPrice10Nt() {
return price10Nt;
}
public void setPrice10Nt(Double price10Nt) {
this.price10Nt = price10Nt;
}
public Double getPrice10() {
return price10;
}
public void setPrice10(Double price10) {
this.price10 = price10;
}
public String getPosgF2() {
return posgF2;
}
public void setPosgF2(String posgF2) {
this.posgF2 = posgF2;
}
public Double getCostP() {
return costP;
}
public void setCostP(Double costP) {
this.costP = costP;
}
public String getPosgFlag() {
return posgFlag;
}
public void setPosgFlag(String posgFlag) {
this.posgFlag = posgFlag;
}
public String getOpenItem() {
return openItem;
}
public void setOpenItem(String openItem) {
this.openItem = openItem;
}
public String getHappyFlag() {
return happyFlag;
}
public void setHappyFlag(String happyFlag) {
this.happyFlag = happyFlag;
}
public Integer getOneToOne() {
return oneToOne;
}
public void setOneToOne(Integer oneToOne) {
this.oneToOne = oneToOne;
}
public Double getCnt() {
return cnt;
}
public void setCnt(Double cnt) {
this.cnt = cnt;
}
public Double getTod() {
return tod;
}
public void setTod(Double tod) {
this.tod = tod;
}
public Double getMtd() {
return mtd;
}
public void setMtd(Double mtd) {
this.mtd = mtd;
}
public Double getYtd() {
return ytd;
}
public void setYtd(Double ytd) {
this.ytd = ytd;
}
public Double getDaySale() {
return daySale;
}
public void setDaySale(Double daySale) {
this.daySale = daySale;
}
public Double getOpnStk() {
return opnStk;
}
public void setOpnStk(Double opnStk) {
this.opnStk = opnStk;
}
public Double getOpnStk2() {
return opnStk2;
}
public void setOpnStk2(Double opnStk2) {
this.opnStk2 = opnStk2;
}
public Double getOpnStk3() {
return opnStk3;
}
public void setOpnStk3(Double opnStk3) {
this.opnStk3 = opnStk3;
}
public Double getPrvOpnStk() {
return prvOpnStk;
}
public void setPrvOpnStk(Double prvOpnStk) {
this.prvOpnStk = prvOpnStk;
}
public Double getPrvOpnBev() {
return prvOpnBev;
}
public void setPrvOpnBev(Double prvOpnBev) {
this.prvOpnBev = prvOpnBev;
}
public Double getOpnBev() {
return opnBev;
}
public void setOpnBev(Double opnBev) {
this.opnBev = opnBev;
}
public Double getBevIn() {
return bevIn;
}
public void setBevIn(Double bevIn) {
this.bevIn = bevIn;
}
public Double getBevOut() {
return bevOut;
}
public void setBevOut(Double bevOut) {
this.bevOut = bevOut;
}
public Double getDaySaleBev() {
return daySaleBev;
}
public void setDaySaleBev(Double daySaleBev) {
this.daySaleBev = daySaleBev;
}
public Double getWastage() {
return wastage;
}
public void setWastage(Double wastage) {
this.wastage = wastage;
}
public String getItRem() {
return itRem;
}
public void setItRem(String itRem) {
this.itRem = itRem;
}
public String getAdd1() {
return add1;
}
public void setAdd1(String add1) {
this.add1 = add1;
}
public String getAdd2() {
return add2;
}
public void setAdd2(String add2) {
this.add2 = add2;
}
public String getAdd3() {
return add3;
}
public void setAdd3(String add3) {
this.add3 = add3;
}
public String getAdd4() {
return add4;
}
public void setAdd4(String add4) {
this.add4 = add4;
}
public Integer getToucol() {
return toucol;
}
public void setToucol(Integer toucol) {
this.toucol = toucol;
}
public String getText_() {
return text_;
}
public void setText_(String text_) {
this.text_ = text_;
}
public Integer getId_() {
return id_;
}
public void setId_(Integer id_) {
this.id_ = id_;
}
}
解决这个错误的正确方法是什么。
提前致谢。
您应该使用 @ColumnInfo(name = "yourcolumn")
注释命名以避免此类错误。
你的情况`
@ColumnInfo(name = "mcode")
public String mCode;