Firebase No properties to serialize found on class
Firebase require your Pojo to have public variables or getter/setter.
Change variable declarations to public
public String nombre;
public String apellidos;
public String telefono;
public String email;
public Boolean tieneWhatsapp;
public Boolean tieneTelegram;
public Boolean tieneHangouts;
public Long formaPago;
public Double ratioHora;
public Double precioHora;
public Double horasCompensadas;
Firebase - No properties to serialize found on class
To solve this, your class needs to implement the Serializable interface:
class dataModel implements Serializable {}
You also need to add a contructor with three arguments. Your class should look like this:
class dataModel implements Serializable {
private String id, name;
private Integer count;
@ServerTimestamp
private Date time;
dataModel() {}
dataModel(String id, String name, Integer count) {
this.id = id;
this.name = name;
this.count = count;
}
}
If the date is null
, it will have the server-generated timestamp. So you don't need to do set the value for it. Please also see the annotation
used to mark a Date
field to be populated with a server timestamp.
Also very important, don't forget to add public getters
.
and the other requirement will be to add -keepclassmembers class com.yourcompany.models.** { *; }
in proguard-rules.pro.
As said here.
DatabaseException: No properties to serialize found on class
Check your detailsOfUser class, it should implement Serializable and have an empty constructor.
When you use FirebaseDatabase the classes you use to represent stored data must be Serializable, this way the object can be turned into a JSON string and vice versa.
Firestore No properties to serialize found on in kotlin
Issue was since some of the variables of the kotlin data class
initialized as null
but without any specific data type. I just added the data types and issue solved
data class Glist (
var id: String,
val ti: String,
val cat: Int
) {
constructor() : this("", "", 0)
var lactuid = Fire.getUid()
var lact = ActionHelper.CREATED_LIST
var lacti = ""
var arch: Date? = null
var del: Date? = null
var lactd: Date
var cre: Date
var cha: Date
var own = Fire.getUid()
var adminuid: ArrayList<String>? = null
var col = ArrayList<String>( )
var ni = ArrayList<String>( )
var nci = ArrayList<String>( )
init {
val now: Date = TimeUtil.getTime()
lactd = now
cre = now
cha = now
col.add(Fire.getUid())
}
}
Firestore : No properties to serialize found on class
The above error was resolved after doing the following:
- Clean and rebuild project.
- Removing all proguard rules.
- Adding
@Keep
in each model class beginning.
Related Topics
How to Throw Checked Exceptions from Inside Java 8 Streams
Java Switch Statement: Constant Expression Required, But It Is Constant
How to Convert an Arraylist Containing Integers to Primitive Int Array
How to Connect Remote MySQL Database in Android Using Jdbc
Custom Listview Click Issue on Items in Android
Permission to Write to the Sd Card
Java Is Installed, in Listing, But Execution Produces "./Java: No Such File or Directory"
File.Encoding Has No Effect, Lc_All Environment Variable Does It
Kafka - Broker: Group Coordinator Not Available
Error Playing Audio File from Java via Pulseaudio on Ubuntu
Hibernate: Hbm2Ddl.Auto=Update in Production
Why Isn't Calling a Static Method by Way of an Instance an Error For the Java Compiler
A Quick and How to Join Array Elements With a Separator (The Opposite of Split) in Java
Iso 8601 String to Date/Time Object in Android
How to Whitelist App in Doze Mode Android 6.0
How to Group a 3X3 Grid of Radio Buttons
Couldn't Install Netbeans 11.3 with Java 14 Due to Error: "Unsupported Jvm Version"