Could not deserialize object. Class does not define a no-argument constructor.If you are using ProGuard, make sure these constructors are not stripped

Issue

https://github.com/neuberfran/JThings/blob/main/app/src/main/java/neuberfran/com/jfran/model/FireFran.kt

I have this POJO above with the error mentioned in the topic. I know it is a mistake already mentioned here, but I have tried several classes (besides this one) and I have not been successful, since my model/POJO class (and Code implementation) is different from several that I saw:(Every help is welcome)

Could not deserialize object. Class does not define a no-argument
constructor. If you are using ProGuard, make sure these constructors
are not stripped (found in field ‘value’)

enter image description here
enter image description here
Change made to the garagem document, exchanged value for valorb, etc…

enter image description here

Solution

First thing: It was not necessary to create the field (map type) called valorb. It was resolved with value.openPercent

As I have two documents (alarme and garagem) I created two POJO classes (FireFran and FireFranB)

https://github.com/neuberfran/JThingsFinal/blob/main/app/src/main/java/neuberfran/com/jfran/model/FireFranB.kt

The secret was to treat the value.on and value.openPercent fields as maps (as facts are):

enter image description here

Answered By – NEUBER SOUSA

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published