我有时会出现这个错误注销,我知道这个logcat意味着我的ABCModel不可序列化但是确实如此。在ABCModel中使用的所有模型实例都是序列化的,
这是完整的Logcat:
05-30 11:38:49.249: E/AndroidRuntime(4305): FATAL EXCEPTION: main
05-30 11:38:49.249: E/AndroidRuntime(4305): java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name =
com.kxs.project.model.ABCModel)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeSerializable(Parcel.java:1181)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeValue(Parcel.java:1135)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeMapInternal(Parcel.java:493)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Bundle.writeToParcel(Bundle.java:1612)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeBundle(Parcel.java:507)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.support.v4.app.FragmentState.writeToParcel(Fragment.java:132)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeTypedArray(Parcel.java:1004)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.support.v4.app.FragmentManagerState.writeToParcel(FragmentManager.java:368)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeParcelable(Parcel.java:1156)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeValue(Parcel.java:1075)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeMapInternal(Parcel.java:493)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Bundle.writeToParcel(Bundle.java:1612)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeBundle(Parcel.java:507)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:1919)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.app.ActivityThread.handleStopActivity(ActivityThread.java:2869)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.app.ActivityThread.access$900(ActivityThread.java:124)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1165)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Looper.loop(Looper.java:137)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.app.ActivityThread.main(ActivityThread.java:4436)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.lang.reflect.Method.invokeNative(Native Method)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.lang.reflect.Method.invoke(Method.java:511)
05-30 11:38:49.249: E/AndroidRuntime(4305): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-30 11:38:49.249: E/AndroidRuntime(4305): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-30 11:38:49.249: E/AndroidRuntime(4305): at dalvik.system.NativeStart.main(Native Method)
05-30 11:38:49.249: E/AndroidRuntime(4305): Caused by: java.io.NotSerializableException: org.json.JSONArray
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1364)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeSerializable(Parcel.java:1176)
05-30 11:38:49.249: E/AndroidRuntime(4305): ... 24 more
答案 0 :(得分:1)
05-30 11:38:49.249: E/AndroidRuntime(4305): Caused by: java.io.NotSerializableException: org.json.JSONArray
可能模型中的某个地方包含JSONArray对象。它不可序列化:JSONArray source code