0

There is a little problem with Firebase and Firebase Snapshot.getValue(mModelClass)

I have Android app wich contains user list(model class - User.java) and interacts with Firebase, structure:

-user
--$user_id
---name
---surname

I've published the app, and now I want to update my app, add new field to the user structure in Firebase:

-user
--$user_id
...
--status

If I do it, then the published app will crash because old model - User.java doesn't has status field and I can't edit pubslished version

Crash text:

Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "status" (class package.User), not marked as ignorable (2 known properties: , "name", "surname"])
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Suleiman
  • 1,003
  • 2
  • 15
  • 29

1 Answers1

2

Finally I found answer:

import org.codehaus.jackson.annotate.JsonIgnoreProperties;

@JsonIgnoreProperties(ignoreUnknown = true)
   public class Foo {
     ...
}

https://stackoverflow.com/a/5455563/2897046

Community
  • 1
  • 1
Suleiman
  • 1,003
  • 2
  • 15
  • 29