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
I just got the same problem but i solved it first check that you have same variable name as firebase jason table variable. In your case CV is returned as Cv in your java class so correct it first than your check the firebase jason table name of that variable CV .
You can map the name without changing variable name using @PropertyName annotation
Kotlin Eg:
data class Category(
@PropertyName("Image")
var img:String="",
@PropertyName("Names")
var name:String="")
SignupTeacher
is private.Simply make sure that all the variables in your model class are declared as private
ie
private String name;
instead of
String name;
Try to fix the capitalization on your fields and methods. firstName
, getFirstName
... etc
Your error is on the CV
field, where the method should be setCV
to match the case of the field, though, you should name it cv
following Java naming contentions. And the method is then get
or setCv
public String getCv() {
return cv;
}
public void setCv(String cv) {
this.cv = cv;
}
I would also suggest not storing passwords as part of your objects. Especially if they are plain text. You send passwords to the database to check for validity or to update; it's seldom a good idea to read them out and persist them elsewhere
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