Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android JsonDeserializer无法反序列化对象_Android_Gson_Json - Fatal编程技术网

Android JsonDeserializer无法反序列化对象

Android JsonDeserializer无法反序列化对象,android,gson,json,Android,Gson,Json,我已开始在Honeycomb上测试应用程序,并收到以下错误消息: com.google.gson.JsonParseException: The JsonDeserializer com.google.gson.DefaultTypeAdapters$CollectionTypeAdapter@408424f0 failed to deserialized json object [{"type":"location","id":1,"name":"Manukau Heights","descr

我已开始在Honeycomb上测试应用程序,并收到以下错误消息:

com.google.gson.JsonParseException: The JsonDeserializer com.google.gson.DefaultTypeAdapters$CollectionTypeAdapter@408424f0 failed to deserialized json object
[{"type":"location","id":1,"name":"Manukau Heights","description":null,"children":[]},{"type":"location","id":2,"name":"Manukau Central","description":null,"children":[]},{"type":"location","id":3,"name":"Manukau City","description":null,"children":[]},{"type":"location","id":4,"name":"Redoubt North","description":null,"children":[]},{"type":"location","id":5,"name":"Redoubt South","description":null,"children":[]},{"type":"location","id":6,"name":"Goodwood Heights","description":null,"children":[]},{"type":"location","id":7,"name":"Totara Heights","description":null,"children":[]},{"type":"location","id":8,"name":"Totara Park","description":null,"children":[]}]
given the type com.google.gson.ParameterizedTypeImpl@8a7527
使用Gson和fromJson时

MyLocation[] locations = gson.fromJson(in, MyLocation[].class);
我的位置如下所示:

private String name = "";
private String type = "";
private String id;
private List<MyLocation> children = new ArrayList<MyLocation>();
private String description = "";
private String name=”“;
私有字符串类型=”;
私有字符串id;
private List children=new ArrayList();
私有字符串描述=”;
我主要担心的是,这在蜂窝之前的许多设备上都能完美工作。我尝试了以下方法: Nexus 1 2.3.4, HTC Hero 2.1更新1, 戴尔场馆2.2.2, 戴尔Streak 7英寸2.2.2, Garmin华硕2.1更新1

我看不到任何例外(而且数据导入似乎很完美)

有人能给我一些建议吗?可能会有什么不同,我如何处理

(我也遇到过类似的问题,XML的解析方式不同,但我设法解决了这一问题,并将其转移到了Honeycomb)

问候,,
Julius。

我改用Jackson,这个问题已经解决了。因此,这并不能解释最初的问题,但似乎有效。

它们应该完全相同,你应该提交一份错误报告。