Search code examples
androidfirebaseproguardandroid-r8

Firebase test lab result : No properties to serialize found on class com.example.poultryscope.ItemModel


My application works well in debug mode, I Generated a signed Android app bundle and tested it by firebase test lab but app crashed during testing.

the test shows Fatal exception : java.lang.RuntimeException: No properties to serialize found on class com.example.poultryscope.ItemModel

here is the error enter image description here

and this is the ItemModel class :

public class ItemModel implements Serializable {
//recyclerview
private int id;
private String name;
private  String nickname;
private int image;

//firestore
private String title;
private List<String> introduction;

private List<String> signs;
private List<String> postmortem;
private String img1;
private String img2;
private String img3;
private String img4;
private String img5;
private  String img6;
private  String img7;
private String img8;
private String collapsingPhoto;
private List<String> prevention;
private List<String> treatment;

public ItemModel() {
}

public ItemModel(String title, List<String> introduction, List<String> signs, List<String> postmortem, String img1, String img2, String img3, String img4, String img5, String img6, String img7, String img8,String collapsingPhoto, List<String> prevention, List<String> treatment) {
    this.title = title;
    this.introduction = introduction;
    this.signs = signs;
    this.postmortem = postmortem;
    this.img1 = img1;
    this.img2 = img2;
    this.img3 = img3;
    this.img4 = img4;
    this.img5 = img5;
    this.img6 = img6;
    this.img7 = img7;
    this.img8 = img8;
    this.collapsingPhoto = collapsingPhoto;
    this.prevention = prevention;
    this.treatment = treatment;
}

public ItemModel(String name, String nickname, int image) {
    this.name = name;
    this.nickname = nickname;
    this.image = image;
}

public ItemModel(int id, String name) {
    this.id = id;
    this.name = name;
}

public ItemModel(String name, String nickname) {
    this.name = name;
    this.nickname = nickname;
}

public String getTitle() {
    return title;
}

public void setTitle(String title) {
    this.title = title;
}

public List<String> getIntroduction() {
    return introduction;
}

public void setIntroduction(List<String> introduction) {
    this.introduction = introduction;
}

public List<String> getSigns() {
    return signs;
}

public void setSigns(List<String> signs) {
    this.signs = signs;
}

public List<String> getPostmortem() {
    return postmortem;
}

public void setPostmortem(List<String> postmortem) {
    this.postmortem = postmortem;
}

public String getImg1() {
    return img1;
}

public void setImg1(String img1) {
    this.img1 = img1;
}

public String getImg2() {
    return img2;
}

public void setImg2(String img2) {
    this.img2 = img2;
}

public String getImg3() {
    return img3;
}

public void setImg3(String img3) {
    this.img3 = img3;
}

public String getImg4() {
    return img4;
}

public void setImg4(String img4) {
    this.img4 = img4;
}

public String getImg5() {
    return img5;
}

public void setImg5(String img5) {
    this.img5 = img5;
}

public String getImg6() {
    return img6;
}

public void setImg6(String img6) {
    this.img6 = img6;
}

public String getImg7() {
    return img7;
}

public void setImg7(String img7) {
    this.img7 = img7;
}

public String getImg8() {
    return img8;
}

public void setImg8(String img8) {
    this.img8 = img8;
}

public String getCollapsingPhoto() {
    return collapsingPhoto;
}

public void setCollapsingPhoto(String collapsingPhoto) {
    this.collapsingPhoto = collapsingPhoto;
}

public List<String> getPrevention() {
    return prevention;
}

public void setPrevention(List<String> prevention) {
    this.prevention = prevention;
}

public List<String> getTreatment() {
    return treatment;
}

public void setTreatment(List<String> treatment) {
    this.treatment = treatment;
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public String getNickname() {
    return nickname;
}

public void setNickname(String nickname) {
    this.nickname = nickname;
}

public void setImage(int image) {
    this.image = image;
}

public int getImage() {
    return image;
}

}

this is the proguard-rules.pro file :

enter image description here


Solution

  • The error was resolved after Adding @Keep in the ItemModel class beginning instead of writing it in the proguard-rules.pro file.