I got a TransactionTooLargeException
. Not reproducible. In the docs it says
The Binder transaction failed because it was too large.
D
It is important to understand that the transaction buffer is limited to 1 MB, regardless of device capabilities or app. This buffer is used with every API calls you make and is shared amongst all transactions an app is currently running.
I believe it also holds some specific object like parcels and such (Parcel.obtain())
, so it's important to always match every obtain()
with a recycle()
.
This error can easily happen on API calls returning a lot of data, even though the returned data is less than 1 MB (if other transactions are still running).
For example, the PackageManager.getInstalledApplication()
call returns a list of all apps installed. Adding specific flags allows to retrieve a lot of extra data. Doing so is likely to fail, so it's recommended not to retrieve any extra data and retrieve those on a per-app basis.
However the call may still fail, so it's important to surround it with a catch
and be able to retry if necessary.
As far as I know, there's no work-around to such issue except retrying and making sure to retrieve as little information as possible.