将 Json 字符串( strWebserviceResult) 转换为我的对象时, 我使用以下代码 :
EntMyClass entMyClass = gson.fromJson(strWebserviceResult,EntMyClass.class);
当 < 坚固> strWebserviceResult 坚固 > 很大( 约2.5 MB) 时, 我得到这条线上的“ 坚固” 排除记忆 坚固” 的例外, 不在有较大内存的平板电脑上的安道尔电话设备上。
我怎样才能解决呢?
有人有什么建议吗?
05-26 15:52:49.607: E/dalvikvm-heap(2078): Out of memory on a 9200-byte allocation.
05-26 15:52:49.618: E/dalvikvm(2078): Out of memory: Heap Size=31879KB, Allocated=27693KB, Bitmap Size=936KB, Limit=32768KB
05-26 15:52:49.618: E/dalvikvm(2078): Extra info: Footprint=31879KB, Allowed Footprint=31879KB, Trimmed=7400KB
05-26 15:52:49.618: E/AndroidRuntime(2078): FATAL EXCEPTION: Thread-19
05-26 15:52:49.618: E/AndroidRuntime(2078): java.lang.OutOfMemoryError: (Heap Size=31879KB, Allocated=27693KB, Bitmap Size=936KB)
05-26 15:52:49.618: E/AndroidRuntime(2078): at java.util.ArrayList.add(ArrayList.java:123)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.DefaultTypeAdapters$CollectionTypeAdapter.deserialize(DefaultTypeAdapters.java:664)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.DefaultTypeAdapters$CollectionTypeAdapter.deserialize(DefaultTypeAdapters.java:624)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.JsonDeserializerExceptionWrapper.deserialize(JsonDeserializerExceptionWrapper.java:51)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.JsonDeserializationVisitor.invokeCustomDeserializer(JsonDeserializationVisitor.java:92)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.JsonObjectDeserializationVisitor.visitFieldUsingCustomHandler(JsonObjectDeserializationVisitor.java:117)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.ReflectingFieldNavigator.visitFieldsReflectively(ReflectingFieldNavigator.java:63)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:120)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.JsonDeserializationContextDefault.fromJsonObject(JsonDeserializationContextDefault.java:76)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:54)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.DefaultTypeAdapters$CollectionTypeAdapter.deserialize(DefaultTypeAdapters.java:663)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.DefaultTypeAdapters$CollectionTypeAdapter.deserialize(DefaultTypeAdapters.java:624)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.JsonDeserializerExceptionWrapper.deserialize(JsonDeserializerExceptionWrapper.java:51)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.JsonDeserializationVisitor.invokeCustomDeserializer(JsonDeserializationVisitor.java:92)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.JsonDeserializationVisitor.visitUsingCustomHandler(JsonDeserializationVisitor.java:80)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:101)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.JsonDeserializationContextDefault.fromJsonArray(JsonDeserializationContextDefault.java:67)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:52)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.Gson.fromJson(Gson.java:551)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.Gson.fromJson(Gson.java:498)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.Gson.fromJson(Gson.java:467)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.Gson.fromJson(Gson.java:417)
05-26 15:52:49.618: E/AndroidRuntime(2078): at com.google.gson.Gson.fromJson(Gson.java:389)
05-26 15:52:49.618: E/AndroidRuntime(2078): at org.mabna.order.businessLayer.BoWebService.getDataForUpdate(BoWebService.java:188)
05-26 15:52:49.618: E/AndroidRuntime(2078): at org.mabna.order.ui.ActToolDataExchange.threadGetDataForFullUpdate(ActToolDataExchange.java:371)
05-26 15:52:49.618: E/AndroidRuntime(2078): at org.mabna.order.ui.ActToolDataExchange.access$9(ActToolDataExchange.java:362)
05-26 15:52:49.618: E/AndroidRuntime(2078): at org.mabna.order.ui.ActToolDataExchange$33.run(ActToolDataExchange.java:603)
05-26 15:52:49.618: E/AndroidRuntime(2078): at org.mabna.order.utils.Utilities$5.run(Utilities.java:778)