0

I'm getting error

java.lang.RuntimeException: No properties to serialize found on class com.dueaoinfo.mycbe.ModelClass.NewsModel

i try this but not work. Firebase No properties to serialize found on class

NewsModel.java

public class NewsModel implements Serializable {
    public static String Title;
    public static String Body;
    public static String Date;
    public static String ID;
    public static String Location;
    public static String Source;

    public NewsModel(String title, String body, String date, String ID, String location, String source) {
        Title = title;
        Body = body;
        Date = date;
        this.ID = ID;
        Location = location;
        Source = source;
    }

    public NewsModel(){

    }

    public static String getTitle() {
        return Title;
    }

    public static void setTitle(String title) {
        Title = title;
    }

    public static String getBody() {
        return Body;
    }

    public static void setBody(String body) {
        Body = body;
    }

    public static String getDate() {
        return Date;
    }

    public static void setDate(String date) {
        Date = date;
    }

    public static String getID() {
        return ID;
    }

    public static void setID(String ID) {
        NewsModel.ID = ID;
    }

    public static String getLocation() {
        return Location;
    }

    public static void setLocation(String location) {
        Location = location;
    }

    public static String getSource() {
        return Source;
    }

    public static void setSource(String source) {
        Source = source;
    }
}

I've checked types, and all are accepted. What's wrong?

  • Please edit your question and add your database structure as a JSON file. You can simply get it by clicking the Export JSON in the overflow menu (⠇) in your [Firebase Console](https://console.firebase.google.com/u/0/project/_/database/data). – Alex Mamo Sep 16 '21 at 07:23

1 Answers1

0
@Keep
public class NewsModel {}

Please use this.

I got the same error and I use this code.

For reference https://stackoverflow.com/a/41141406/13560223

Aftab Abbas
  • 47
  • 1
  • 10
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-ask). – Community Sep 16 '21 at 07:41