I am developing an app, that has 13 fragments. I tested it on many virtual android devices and it crashes with the following exception only in Android Version 4.4.4 with resolution 1080x1920:
android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
(...)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at (...)
Caused by: java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:594)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:429)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:840)
at (...) //output is same like in the link with question below
all fragments have the same layout xml and on the second line it is a declaration of LienarLayout.
I have already read the questions like android.view.InflateException: Binary XML file line #2: Error inflating class <unknown> and all the images, that I use, are with resolution 720x1280 (xhdpi) and are loaded from the xml as background of the fragments, not as Bitmap or what else.
Here is the beginning of the layout xml file, where the line #2 is:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
android:id="@+id/frg_bckg">
I have no real device with the same parameters to test it. Does anybody know what could be the reason for this exception and if it will appear on a real device too?
Thank you in advance!