java.lang.OutOfMemoryError: bitmap size exceeds VM budget - Android

前端 未结 13 1786
醉话见心
醉话见心 2020-11-22 01:32

I developed an application that uses lots of images on Android.

The app runs once, fills the information on the screen (Layouts, Listviews,

13条回答
  •  情深已故
    2020-11-22 02:29

    I suggest a convenient way to solve this problem. Just assign the attribute "android:configChanges" value as followed in the Mainfest.xml for your errored activity. like this:

    
    
    

    the first solution I gave out had really reduced the frequency of OOM error to a low level. But, it did not solve the problem totally. And then I will give out the 2nd solution:

    As the OOM detailed, I have used too much runtime memory. So, I reduce the picture size in ~/res/drawable of my project. Such as an overqualified picture which has a resolution of 128X128, could be resized to 64x64 which would also be suitable for my application. And after I did so with a pile of pictures, the OOM error doesn't occur again.

提交回复
热议问题