TransactionTooLargeEception when trying to get a list of applications installed

后端 未结 2 1170
Happy的楠姐
Happy的楠姐 2021-01-31 06:13

As part of my app I get a list of apps installed on the device by using ApplicationPackageManager.getInstalledApplications but for some users I get crash reports saying that

2条回答
  •  抹茶落季
    2021-01-31 06:54

    This exception is kind of difficult to reproduce under normal circumstances. You will get this exception when there IPC memory is exhausted when transferring data. This can occur in both cases, where a service is trying to place data to client or a client is sending data to service. Most probably some of your users might have installed huge number of application, which results in a data size greater than 1MB (which is the size of IPC buffer).

    I am afraid in this case, you will not be do anything better. But if you are doing something like, applyBatch, you can separate one large transaction to multiple smaller transactions.

    Also have a look at this thread What to do on TransactionTooLargeException

提交回复
热议问题