Android:java.lang.OutOfMemoryError: Failed to allocate a 23970828 byte allocation with 2097152 free bytes and 2MB until OOM

前端 未结 30 2058
暗喜
暗喜 2020-11-21 07:33

I want to show the Bitmap image in ImageView from sd card which is stored already. After run my application is crash and getting Ou

30条回答
  •  鱼传尺愫
    2020-11-21 08:02

    Your app is crashing because your image size (in MB Or KB) is too large so it is not allocating space for that. So before pasting your image in drawable just reduce the size.

    OR

    You can add Following in application tag at Manifest.xml

     android:hardwareAccelerated="false"
        android:largeHeap="true"
        android:allowBackup="true"
    

    After Adding this App will not Crash.

    • always use less sizes images in App.
    • If You adding large sizes of images in app , you should add above syntex, but App size will increase.

提交回复
热议问题