最小化app时的TransactionTooLargeException

时间:2017-05-28 21:21:23

标签: android json exception bundle

当我关闭/最小化我的应用时,我遇到了TransactionTooLargeException。我假设它是由于我的Bundle太大(3个JSONArrays作为字符串),但如果有人可以从我的错误跟踪中诊断出更多信息,那将会很棒。

这是:

05-28 17:17:25.994 9518-9518/com.adamtrudeauarcaro.godbuilder E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!  (parcel size = 551100)
05-28 17:17:25.996 9518-9518/com.adamtrudeauarcaro.godbuilder D/AndroidRuntime: Shutting down VM
05-28 17:17:25.998 9518-9518/com.adamtrudeauarcaro.godbuilder E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                Process: com.package.godbuilder, PID: 9518
                                                                                java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 551100 bytes
                                                                                    at android.app.ActivityThread$StopInfo.run(ActivityThread.java:4211)
                                                                                    at android.os.Handler.handleCallback(Handler.java:751)
                                                                                    at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                    at android.os.Looper.loop(Looper.java:154)
                                                                                    at android.app.ActivityThread.main(ActivityThread.java:6688)
                                                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
                                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
                                                                                 Caused by: android.os.TransactionTooLargeException: data parcel size 551100 bytes
                                                                                    at android.os.BinderProxy.transactNative(Native Method)
                                                                                    at android.os.BinderProxy.transact(Binder.java:628)
                                                                                    at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:4132)
                                                                                    at android.app.ActivityThread$StopInfo.run(ActivityThread.java:4203)
                                                                                    at android.os.Handler.handleCallback(Handler.java:751) 
                                                                                    at android.os.Handler.dispatchMessage(Handler.java:95) 
                                                                                    at android.os.Looper.loop(Looper.java:154) 
                                                                                    at android.app.ActivityThread.main(ActivityThread.java:6688) 
                                                                                    at java.lang.reflect.Method.invoke(Native Method) 
                                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468) 
                                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358) 

1 个答案:

答案 0 :(得分:4)

从您的错误跟踪中它没有说,但我可以从经验中告诉您,当您的捆绑包太大而无法将其存储为已保存的实例状态时,会发生这种情况。这意味着当您最小化应用程序时,它会尝试调用onSaveInstanceState并且您的数据包存储的数据多于系统支持的数据。