Skip to content Skip to sidebar Skip to footer

Firebase's Androidchat Example: Failed To Bounce To Type

This question is also trying to find out the answer for this question that I posted several days ago. The weird thing about the AndroidChat app is when I changed the Chat class pro

Solution 1:

It looks like you have only changed on chat message, not all of them. When the code attempts to deserialize a message that you haven't changed to author2, it cannot find the author field and throws an exception.

Try either changing all of the messages to author2, or clear out your data and start over with the new field names.

Solution 2:

To flesh out Greg's answer more, the chat example is reliant on everything being named correctly across the data in the Firebase as well as on the Android client side. Normally, the Firebase looks like this:

android-chat
|---> chat
   |---> pushID
      |---> author
      |---> message

If you modify the names of the properties in the Chat.java file or you change the name of ANY of the fields via Forge: https://android-chat.firebaseio-demo.com/ it has the potential to cause this error, since the object cannot be properly created because the JSON to object map link is severed (See FirebaseListAdaptor.java line 63 for this mapping). If a single one of the items stored in the Firebase is incorrect, or the Chat Object naming is incorrect, this error will fire.

On a side note, when users want to play around with the data structure of an app, please create a separate test Firebase and develop on that. I'm not sure which Firebase this happened on, but it's always good practice to spin up a Firebase that is separate from anything currently being used by others.

Happy hacking!

Solution 3:

Adding to the answers above.

I was trying to modify the android chat example and I was doing that correctly all the names were correct and as per the forge. Still I was getting the same error.

Answer :When creating Bean class, include every child in the structure without leaving any entry.

In my case I was trying to create a bean according to android application's requirement and thus the error.

Example: I just had two getter methods declared for author and message ( Which is wrong. )

android-chat
|---> chat
    |---> pushID
        |---> author
        |---> message
        |---> time
        |---> fourthChild

Solution 4:

you must fallow Java Bean Conviction

I was struggling with this error just because I messed the default constructor

Post a Comment for "Firebase's Androidchat Example: Failed To Bounce To Type"