java.lang.OutOfMemoryError BitmapFactory.nativeDecodeAsset()

前端 未结 2 817
南笙
南笙 2021-01-05 02:08

Hi i am creating an app about traffic signs. traffic signs are in .png format. some of them I am showing in horizontalscrollview. But when try to open activities , I get thi

2条回答
  •  执笔经年
    2021-01-05 03:12

    The "bitmap size exceeds VM budget" error is actually in the native graphics library (Skia). It is a tad confusing as the problem is really that Skia has run out of memory in the native heap for bitmap data. See BitmapFactory OOM driving me nuts for background. To get round this, you will have to look carefully at your bitmap usage

    • making sure that you do not leave bitmap references floating
    • doing a recycle / null onn bitmaps as they become free (this appears to help).

提交回复
热议问题