火力地堡的Andr​​oidChat例如:无法反弹打字 [英] Firebase's AndroidChat example: Failed to bounce to type

查看:273
本文介绍了火力地堡的Andr​​oidChat例如:无法反弹打字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这问题也在试图找出这个答案<一href="http://stackoverflow.com/questions/21626707/fail-to-display-data-as-listview-from-firebase">question我贴数天前。

奇怪的有关AndroidChat应用程序是,当我改变了聊天类属性命名为不同的名字。这导致无法反弹键入异常。当我改了名字(从作者到author2)在我火力比如同样的事情发生了。下面是截图说明什么,我想说的。也有一个LogCat中底:

在从撰文改变Chat.java到author2:

或改变同样的事情在火力的实例时:

同样的错误发生了:

LogCat中的日志:

 十一月2号至11号:52:11.735:D / dalvikvm(16033):GC_CONCURRENT释放339K,12%的自由7825K / 8839K,暂停17MS + 5ms的,总69ms
11月2日至11日:52:12.835:D / dalvikvm(16033):GC_CONCURRENT释放462K,13%免费7869K / 9031K,暂停为5ms + 3ms的,共有40毫秒
11月2日至11日:52:12.940:D / dalvikvm(16033):GC_CONCURRENT释放446K,13%免费7889K / 9031K,暂停11毫秒+ 1毫秒,总34ms
11月2日至11日:52:13.140:D / AndroidRuntime(16033):关闭虚拟机
11月2日至11日:52:13.140:W / dalvikvm(16033):主题ID = 1:螺纹退出与未捕获的异常(组= 0x41c992a0)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):致命异常:主要
11月2日至11日:52:13.150:E / AndroidRuntime(16033):com.firebase.client.FirebaseException:未能反弹打字
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在com.firebase.client.DataSnapshot.getValue(DataSnapshot.java:185)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在com.firebase.androidchat.FirebaseListAdapter $ 1.onChildAdded(FirebaseListAdapter.java:63)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在com.firebase.client.core.ChildListenerContainer $ 1.运行(ChildListenerContainer.java:52)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在android.os.Handler.handleCallback(Handler.java:615)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在android.os.Handler.dispatchMessage(Handler.java:92)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在android.os.Looper.loop(Looper.java:137)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在android.app.ActivityThread.main(ActivityThread.java:4947)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在java.lang.reflect.Method.invokeNative(本机方法)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在java.lang.reflect.Method.invoke(Method.java:511)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1038)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在dalvik.system.NativeStart.main(本机方法)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):com.shaded.fasterxml.jackson.databind.exc.UnrecognizedPropertyException:产生的原因无法识别领域的作者(类com.firebase.androidchat.Chat),不标记为可忽略(一个已知的属性:消息])
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在[来源:java.io.StringReader@424dcef8;行:1,柱:45](通过参考链:com.firebase.androidchat.Chat [作者])
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在com.shaded.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(DeserializationContext.java:555)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在com.shaded.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:708)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在com.shaded.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1160)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在com.shaded.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:315)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在com.shaded.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:121)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在com.shaded.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2888)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在com.shaded.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2034)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):在com.firebase.client.DataSnapshot.getValue(DataSnapshot.java:181)
11月2日至11日:52:13.150:E / AndroidRuntime(16033):11 ...更多
 

解决方案

它看起来像你只改变了聊天信息,不是所有的人。当code试图反序列化,你有没有改变author2消息时,它无法找到作者字段并抛出异常。

尝试要么改变所有的邮件到author2,或清除出你的数据并重新开始与新的字段名。

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 properties name to different name. It result in a "Failed to bounce to type" exception. Same thing happened when I changed the name (from author to author2) in my firebase instance. Below are screenshots describing what I'm trying to say. Also there is a LogCat at the end:

When changing from author to author2 in Chat.java:

OR when changing the same thing in firebase's instance:

Same error happens:

LogCat's log:

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

解决方案

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.

这篇关于火力地堡的Andr​​oidChat例如:无法反弹打字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆