Am getting this error while trying to save an Object on the Firebase
database that has an Asset
property.
Similar errors have been documented in the following questions:
Firebase No properties to serialize found on class
Firebase No properties to serialize found with object in release mode
and a few others.
Some of the solutions recommended are to
- Change variable declarations to public
- Add
@Keep
to the class declaration - Add
-keepclassmembers class com.yourcompany.models.** { *; }
in Proguard-rules
but none of these options have worked for me.
What I've tried is create another class that is a replica of the class am using for Vault
and then have a String
property that holds the URL
of the Asset
but this seems like duplication of code and unnecessary.
Is there a solution to this problem?
I am Mario Bodemann, a maintainer of the Java and Android SDKs of Contentful.
I would recommend separating the concerns between the Firebase use-case and the Contentful use-case, as you suggested too.
This way you can make sure to provide Firebase with a model that it needs and Contentful with a model that it needs, without intermixing both. I don't see it as repeating code, you are repeating data. And that should be alright for different use-cases.
Probably some factories for converting from one form to the other on a per need basis would be convenient too.
Otherwise, maybe if you could share a bit more about your use of both in one app, we could be able to help you a bit more...
Greetings, Mario