Here is my code:
input.xml (layout folder)
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
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.
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..
I've solved the same problem by reducing dimension of .png buttons in all xml files
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.
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.