I'm trying to use Firebase Android with some simple POJO but I'm getting some exceptions even with the following sample code
final Firebase fb = getFirebaseAccess();
final Subscription subscription = new Subscription(url, System.currentTimeMillis());
Firebase subscriptionRef = fb.child("subscriptions").push();
subscriptionRef.setValue(subscription); // exception thrown here
// Subscription.java
public class Subscription {
private String url;
private long subscribedAt;
public Subscription() {
}
public Subscription(String url, long subscribedAt) {
this.url = url;
this.subscribedAt = subscribedAt;
}
public String getUrl() {
return this.url;
}
public void setUrl(String url) {
this.url = url;
}
public long getSubscribedAt() {
return this.subscribedAt;
}
public void setSubscribedAt(long subscribedAt) {
this.subscribedAt = subscribedAt;
}
}
The following exception is thrown:
Failed to parse to snapshot com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class com.mypackage.Subscription and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) No serializer found for class com.myPackage.Subscription and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) )
I don't understand what's failing because I kept the public default constructor and every variable has its own public getter...
Any idea ?
BTW if I replace the POJO with a String field or a map of attributes it works fine
Edit: I'm using Proguard with minify enabled. I have the following instructions:
# Firebase 2.0
# keep POJOs
-keepnames class com.myPackage.** { *; }
-keep class com.firebase.** { *; }
-keep class org.apache.** { *; }
-keepnames class com.fasterxml.jackson.** { *; }
-keepnames class javax.servlet.** { *; }
-keepnames class org.ietf.jgss.** { *; }
-dontwarn org.w3c.dom.**
-dontwarn org.joda.time.**
-dontwarn org.shaded.apache.**
-dontwarn org.ietf.jgss.**