android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>

牧云@^-^@ 提交于 2019-11-27 08:52:23

At runtime, Android resize's images based on need (based on the screen size and resolution). It uses Bitmap's for doing the resizing internally. Which, obviously, is very memory intensive (kinda allocates memory like crazy). One quick way to fix such issues can be, that you copy all drawable files to drawable-ldpi, mdpi, hdpi folders. This way android will just pick up the files from these folders and not resize them.

Its a random kind exception, a real pain to fix.

Mahadev Dalavi

please follow background image size

for Supported device

LDPI:
Portrait: 200x320px
Landscape: 320x200px
MDPI:
Portrait: 320x480px
Landscape: 480x320px
HDPI:
Portrait: 480x800px
Landscape: 800x480px
XHDPI:
Portrait: 720px1280px
Landscape: 1280x720px
Amin Zargar

As the others clarified, part of a problem was an issue related to the background image I'd set for my layout. However, getting that solved, I persistently encountered the error:

Unfortunately the application has stopped

With trial and error, I found the problem was caused by the <view> elements which after deleting them, I could eventually run the application.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!