I am new in android architecture component. I am trying to build app with the reference of android-architecture-components/BasicRxJavaSample with the same Gradle configuration. But I get the following errors..
- Error:(14, 8) error: Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).Tried the following constructors but they failed to match:= Department(java.lang.String,java.lang.String) : [id : null, dep : null]
- Error:(16, 20) error: Cannot find setter for field.
- Error:(18, 20)error: Cannot find setter for field.
I am using Version "1.0.0-alpha9" for all architecture Components. I have tried with current "1.0.0-beta1" version also.
I have looked [Ambiguous getter for Field… Room persistence library 2 link also but according to google sample not need to setter for every field.
Model class
@Entity(tableName = "tblDepartment")
public class Department{
@PrimaryKey
private String mId;
private String mName;
@Ignore
public Department(String dep) {
mId= UUID.randomUUID().toString();
mName= dep;
}
public Department(String id, String dep) {
mId = id;
mName=dep;
}
public String getDepartmentId() {
return mId;
}
public String getDepartmentName() {
return mName;
}
}
Expense
class. Your question shows aDepartment
class. Either you have the wrong error message or the wrong code. - CommonsWare