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

The inflate exception is not actually the problem but really comes from another deeper issue in your layout that is then wrapped in an InflateException. A common issue is an out of memory exception when trying to inflate an ImageView loading a drawable resource. If one of these resources has a high pixel resolution it would take a lot of memory causing then an inflate exception.

So basically verify that the pixel resolution in all your image drawables is just the minimum necessary for your layout.


This can also happen if you use a VectorDrawable using support library and forgot to use app:srcCompat instead of android:src

Exact error is: Binary XML file line #XX: Error inflating class ImageView

See that link


ViewFlipper loads all images into memory during layout inflating. Because my images are big it takes many memory, I replaced ViewFlipper with ImageSwitcher which can change the images with animation like ViewFlipper but it loads only one image at the time.