Binary XML file line #2: Error inflating class <unknown>

I think the problem is that your xml class definition doesn't match the package you have in your custom class. Assuming it is correct in your class, try changing the xml to

 <com.jaisri.myapp.Scrolltext
        android:id="@+id/jkruntext1"

I haven't used custom Views much but I'm pretty sure this is a problem. Hope this helps


If you examine the Caused by: lines, it looks like the root cause is an OutOfMemoryError that's occurring in BitmapFactory.nativeDecodeAsset(). (Note also the references to "Out of memory on a 36864016-byte allocation").

Are you trying to include a very large image file in your layout somewhere?


Just for future people having this issue you can add in manifest:

android:largeHeap="true"

this fixed the issue for me.