怎么做TransactionTooLargeException [英] What to do on TransactionTooLargeException

查看:172
本文介绍了怎么做TransactionTooLargeException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了一个应用程序TransactionTooLargeException的错误轨道。前不可再现的,从未发生过的。在文档,它说

I got in error track of an app TransactionTooLargeException. Not reproducible and never had it before. In the docs it says

该粘合剂的交易失败,因为它太大了。

The Binder transaction failed because it was too large.

在远程过程调用,参数和调用的返回值传送存储在活页夹事务缓冲区地块对象。如果参数或者返回值过大,以适应在交易缓冲区中,然后调用将失败,TransactionTooLargeException将被抛出。

During a remote procedure call, the arguments and the return value of the call are transferred as Parcel objects stored in the Binder transaction buffer. If the arguments or the return value are too large to fit in the transaction buffer, then the call will fail and TransactionTooLargeException will be thrown.

...

有两种可能的结果时,远程过程调用抛出TransactionTooLargeException。无论是客户端无法发送其请求服务(最有可能的,如果参数过大,以适应在交易缓冲区),或服务无法发送它的响应返回给客户端(最有可能的,如果返回值是过大而无法在交易缓冲区)。

There are two possible outcomes when a remote procedure call throws TransactionTooLargeException. Either the client was unable to send its request to the service (most likely if the arguments were too large to fit in the transaction buffer), or the service was unable to send its response back to the client (most likely if the return value was too large to fit in the transaction buffer).

...

那么,好吧,什么地方我传递或接收参数超出一些未知的限制。但是,在哪里?

So, ok, somewhere I'm passing or receiving arguments which exceed some unknown limit. But where?

该堆栈跟踪不会从我的文件显示任何内容:

The stacktrace doesn't show anything from my files:

java.lang.RuntimeException: Adding window failed
at android.view.ViewRootImpl.setView(ViewRootImpl.java:548)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:406)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:320)
at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:152)
at android.view.Window$LocalWindowManager.addView(Window.java:557)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2897)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$600(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4977)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.os.TransactionTooLargeException
at android.os.BinderProxy.transact(Native Method)
at android.view.IWindowSession$Stub$Proxy.add(IWindowSession.java:569)
at android.view.ViewRootImpl.setView(ViewRootImpl.java:538)
... 16 more
android.os.TransactionTooLargeException
at android.os.BinderProxy.transact(Native Method)
at android.view.IWindowSession$Stub$Proxy.add(IWindowSession.java:569)
at android.view.ViewRootImpl.setView(ViewRootImpl.java:538)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:406)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:320)
at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:152)
at android.view.Window$LocalWindowManager.addView(Window.java:557)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2897)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$600(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4977)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)

这似乎与观点有关,因为所有的窗口/视图线?这是如何与远程过程调用?我该如何寻找这个错误的原因是什么?

It seems to be related with views, because all the Window / View lines? How is this related to remote procedure call? How can I look for the reason of this error?

在我使用的唯一的,我没有使用服务类Webservices的应用程序,是在Webservices的远程过程调用或什么别的可能是...?

In the app I'm using only Webservices, I'm not using Service class, are the Webservices the "remote procedure calls" or what else could be...?

在此先感谢...

P.S。也许这是很重要的:Android版本:4.0.3,设备:HTC One X的

P.S. Maybe it's important: Android version: 4.0.3, Device: HTC One X

推荐答案

我遇到过这个问题,而且我发现,当有大量的数据得到一个服务和应用程序之间交换的(这涉及到转让缩略图的手)。实际数据的大小约为500KB,和IPC的事务缓冲器的大小设置为1024KB。我不知道为什么它超过了事务缓冲区。

I encountered this issue, and I found that when there huge amount of data getting exchanged between a service and an application,(This involves transferring lots of thumbnails). Actually data size was around 500kb, and the IPC transaction buffer size is set to 1024KB. I am not sure why it exceeded the transaction buffer.

这也可能发生,当你通过额外的意图传递大量的数据,

This also can occur, when you pass lot of data through intent extras

当你得到这个例外在您的应用程序,请分析你的code。

When you get this exception in your application, please analyze your code.

  1. 你交换大量的服务和应用程序之间的数据?
  2. 使用意图分享海量数据,(例如,用户选择从画廊份额preSS共享文件的数量巨大,所选择的文件的URI将使用意图转移)
  3. 接收来自服务的位图文件
  4. 在等待机器人来响应与庞大的数据(例如,getInstalledApplications(),当用户安装很多应用程序)
  5. 在使用applyBatch()有很多操作挂起

如何处理当你得到这个异​​常

如果可能的话,拆分大的操作中一小块一小块,例如,而不是调用applyBatch()与1000业务,与100每次调用它。

If possible, split the big operation in to small chunks, for example, instead of calling applyBatch() with 1000 operations, call it with 100 each.

不要交换大量数据(> 1MB)服务和应用程序之间

Do not exchange huge data (>1MB) between services and application

我不知道如何做到这一点,但是,不询问机器人,它可以返回庞大的数据: - )

I dont know how to do this, but, Do not query android, which can return huge data :-)

这篇关于怎么做TransactionTooLargeException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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