No properties to serialize found on class com.contentful.vault.Asset

542 views Asked by At

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

  1. Change variable declarations to public
  2. Add @Keep to the class declaration
  3. 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?

1

There are 1 answers

1
Mario Bodemann On

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