InflateException: Binary XML file line #1: Error inflating class caused by OutOfMemoryError

前端 未结 10 1597
梦如初夏
梦如初夏 2020-11-27 05:59

Here is my code:

input.xml (layout folder)



        
相关标签:
10条回答
  • 2020-11-27 06:15

    Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget may be the real culprit here. Try using smaller image to see if it is a memory-related issue. Check out these links for examples of similar issues:

    java.lang.OutOfMemoryError: bitmap size exceeds VM budget - android - how many images? and OutOfMemory exception when loading bitmap from external storage

    0 讨论(0)
  • 2020-11-27 06:22

    The problem occurs because the *drawable/background_main* has a high resolution image. So when it loads then the VM runs out of memory .

    So best way is to reduce it size or resolution.

    0 讨论(0)
  • 2020-11-27 06:23

    You are using this layout in fragment not in Activity.And also there is another exception OutOfMemory your background image is very large try to reduce it..

    0 讨论(0)
  • 2020-11-27 06:24

    I've solved the same problem by reducing dimension of .png buttons in all xml files

    0 讨论(0)
  • 2020-11-27 06:24

    In my case I was getting illogical class inflation exceptions, after digging for a while I found that the error was caused due to deprecated code blocks related to android framework itself.

    0 讨论(0)
  • 2020-11-27 06:33

    Check your drawable/background_main i.e. the background image of your root layout - the VM runs out of memory when decoding the bitmap. Make the image dimensions smaller.

    0 讨论(0)
提交回复
热议问题