这个问题还试图找出我几天前发布的question的答案。

关于AndroidChat应用程序的怪异事情是,当我将Chat类的属性名称更改为其他名称时。导致出现“无法弹跳键入”异常。当我在Firebase实例中将名称(从author更改为author2)时,发生了同样的事情。以下是描述我要说的屏幕截图。最后还有一个LogCat:

在Chat.java中从author2更改为author2时:



或在firebase实例中更改相同内容时:



发生相同的错误:



LogCat的日志:

02-11 11:52:11.735: D/dalvikvm(16033): GC_CONCURRENT freed 339K, 12% free 7825K/8839K, paused 17ms+5ms, total 69ms
02-11 11:52:12.835: D/dalvikvm(16033): GC_CONCURRENT freed 462K, 13% free 7869K/9031K, paused 5ms+3ms, total 40ms
02-11 11:52:12.940: D/dalvikvm(16033): GC_CONCURRENT freed 446K, 13% free 7889K/9031K, paused 11ms+1ms, total 34ms
02-11 11:52:13.140: D/AndroidRuntime(16033): Shutting down VM
02-11 11:52:13.140: W/dalvikvm(16033): threadid=1: thread exiting with uncaught exception (group=0x41c992a0)
02-11 11:52:13.150: E/AndroidRuntime(16033): FATAL EXCEPTION: main
02-11 11:52:13.150: E/AndroidRuntime(16033): com.firebase.client.FirebaseException: Failed to bounce to type
02-11 11:52:13.150: E/AndroidRuntime(16033):    at com.firebase.client.DataSnapshot.getValue(DataSnapshot.java:185)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at com.firebase.androidchat.FirebaseListAdapter$1.onChildAdded(FirebaseListAdapter.java:63)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at com.firebase.client.core.ChildListenerContainer$1.run(ChildListenerContainer.java:52)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at android.os.Handler.handleCallback(Handler.java:615)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at android.os.Handler.dispatchMessage(Handler.java:92)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at android.os.Looper.loop(Looper.java:137)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at android.app.ActivityThread.main(ActivityThread.java:4947)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at java.lang.reflect.Method.invokeNative(Native Method)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at java.lang.reflect.Method.invoke(Method.java:511)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at dalvik.system.NativeStart.main(Native Method)
02-11 11:52:13.150: E/AndroidRuntime(16033): Caused by: com.shaded.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "author" (class com.firebase.androidchat.Chat), not marked as ignorable (one known property: "message"])
02-11 11:52:13.150: E/AndroidRuntime(16033):  at [Source: java.io.StringReader@424dcef8; line: 1, column: 45] (through reference chain: com.firebase.androidchat.Chat["author"])
02-11 11:52:13.150: E/AndroidRuntime(16033):    at com.shaded.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(DeserializationContext.java:555)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at com.shaded.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:708)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at com.shaded.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1160)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at com.shaded.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:315)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at com.shaded.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:121)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at com.shaded.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2888)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at com.shaded.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2034)
02-11 11:52:13.150: E/AndroidRuntime(16033):    at com.firebase.client.DataSnapshot.getValue(DataSnapshot.java:181)
02-11 11:52:13.150: E/AndroidRuntime(16033):    ... 11 more

最佳答案

看来您只更改了聊天消息,而不是全部更改。当代码尝试反序列化您尚未更改为author2的消息时,它将找不到author字段并引发异常。

尝试将所有消息更改为author2,或者清除数据并重新使用新的字段名称。

关于java - Firebase的AndroidChat示例:无法反弹以键入,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21698441/

10-10 04:47