Android HttpEntityUtils OutOfMemoryException

后端 未结 2 1844
清酒与你
清酒与你 2021-01-24 23:24

I\'m working on a project which connect to a web server and receive binary data. My problem is when I\'m downloading data from web server. If i send request to login or to activ

2条回答
  •  一生所求
    2021-01-25 00:02

    On Android you only have a limited heap size, which gets exhausted while you try to decode your entity. I think you need to use http chunking to send your data to the client (or something goes wrong and the EntityUtils think they need a much bigger array. The problem is a byte array which is to big not to small. Have a look at this posts:

    1. Detect application heap size in Android
    2. Android heap size on different phones/devices and OS versions

提交回复
热议问题