title: Android: InflateException: Binary XML file line : Error inflating class <unknown>
body: <p>I had gone through several posts over this issue but nothing helped me. The problem is occuring only on large screen devices. Below is stack trace.</p>
  
  <p><strong>Logcat output</strong></p>
  
  <pre><code>03-13 15:21:18.863: E/AndroidRuntime(6334): FATAL EXCEPTION: main
  03-13 15:21:18.863: E/AndroidRuntime(6334): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dzo.seattlesnightlife/com.dzo.seattlesnightlife.StoreDescription}: android.view.InflateException: Binary XML file line #29: Error inflating class &lt;unknown&gt;
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.app.ActivityThread.access$600(ActivityThread.java:130)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.os.Handler.dispatchMessage(Handler.java:99)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.os.Looper.loop(Looper.java:137)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.app.ActivityThread.main(ActivityThread.java:4745)  
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at java.lang.reflect.Method.invokeNative(Native Method)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at java.lang.reflect.Method.invoke(Method.java:511)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at dalvik.system.NativeStart.main(Native Method)
  03-13 15:21:18.863: E/AndroidRuntime(6334): Caused by: android.view.InflateException: Binary XML file line #29: Error inflating class &lt;unknown&gt;
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.view.LayoutInflater.createView(LayoutInflater.java:613)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:805)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)  
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.app.Activity.setContentView(Activity.java:1867)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at com.dzo.seattlesnightlife.StoreDescription.init(StoreDescription.java:195)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at com.dzo.seattlesnightlife.StoreDescription.onCreate(StoreDescription.java:188)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.app.Activity.performCreate(Activity.java:5008)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     ... 11 more
  03-13 15:21:18.863: E/AndroidRuntime(6334): Caused by: java.lang.reflect.InvocationTargetException
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at java.lang.reflect.Constructor.constructNative(Native Method)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.view.LayoutInflater.createView(LayoutInflater.java:587)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     ... 30 more
  03-13 15:21:18.863: E/AndroidRuntime(6334): Caused by: java.lang.OutOfMemoryError
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.content.res.Resources.loadDrawable(Resources.java:1930)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.content.res.Resources.getDrawable(Resources.java:659)  
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)  
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:881)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.graphics.drawable.Drawable.createFromXml(Drawable.java:818)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.content.res.Resources.loadDrawable(Resources.java:1915)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.view.View.&lt;init&gt;(View.java:3336)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:427)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.widget.LinearLayout.&lt;init&gt;(LinearLayout.java:176)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     at android.widget.LinearLayout.&lt;init&gt;(LinearLayout.java:172)
  03-13 15:21:18.863: E/AndroidRuntime(6334):     ... 33 more
  </code></pre>
  
  <p><strong>XML Layout file</strong></p>
  
  <p>
  </p>
  
  <pre><code>&lt;com.dzo.seattlesnightlife.ui.HeaderBar
      android:id="@+id/baseHeaderBar"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentTop="true" /&gt;
  
  &lt;com.handmark.pulltorefresh.library.PullToRefreshListView
      android:id="@+id/listViewSearch"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_below="@+id/baseHeaderBar"
      android:layout_marginBottom="55dp"
      android:listSelector="@drawable/list_sel"
      android:cacheColorHint="#00000000"
      android:divider="@color/divider_list"
      android:layout_marginTop="-3dp"
      android:dividerHeight="2dp" /&gt;
  
  &lt;TextView
      android:id="@+id/txtNoData"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerInParent="true"
      android:text="@string/no_data"
      android:textColor="@color/white"
      android:textSize="18sp"
      android:visibility="gone" /&gt;
  
  &lt;ScrollView
      android:id="@+id/scrollLayout"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_below="@+id/baseHeaderBar"
      android:layout_marginBottom="60dp"
      android:scrollbars="none" &gt;
  
      &lt;LinearLayout
          android:id="@+id/linScrollView"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:gravity="center|top"
          android:orientation="vertical" &gt;
  
          &lt;RelativeLayout
              android:id="@+id/linImgAddress"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_marginLeft="5dp"
              android:layout_marginRight="5dp"
              android:layout_marginTop="5dp"
              android:orientation="horizontal" &gt;
  
              &lt;LinearLayout
                  android:id="@+id/linImgListingPhoto"
                  android:layout_width="143dp"
                  android:layout_height="143dp"
                  android:layout_marginTop="10dp"
                  android:background="@drawable/bg_description"
                  android:gravity="center"
                  android:orientation="vertical" &gt;
  
                  &lt;ImageView
                      android:id="@+id/imgListingPhoto"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:contentDescription="@string/d_desc"
                      android:scaleType="fitXY" /&gt;
              &lt;/LinearLayout&gt;
  
              &lt;ImageButton
                  android:id="@+id/btnFav"
                  android:layout_width="30dp"
                  android:layout_height="30dp"
                  android:layout_gravity="top|left"
                  android:layout_marginTop="5dp"
                  android:background="@drawable/ic_fav"
                  android:contentDescription="@drawable/ic_fav" /&gt;
  
              &lt;LinearLayout
                  android:id="@+id/linPromoTitle"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:layout_toRightOf="@+id/linImgListingPhoto"
                  android:layout_marginTop="10dp"
                  android:layout_marginLeft="5dp"
                  android:gravity="top"
                  android:orientation="vertical" &gt;
  
                  &lt;TextView
                      android:id="@+id/txtListingTitle"
                      android:layout_width="match_parent"
                      android:layout_height="40dp"
                      android:background="@drawable/bg_description"
                      android:gravity="center_vertical|center_horizontal"
                      android:textColor="@color/white"
                      android:textSize="20sp" /&gt;
  
                  &lt;LinearLayout
                      android:id="@+id/linAddressWebsite"
                      android:layout_width="match_parent"
                      android:layout_height="100dp"
                      android:layout_marginTop="3dp"
                      android:background="@drawable/bg_description"
                      android:orientation="vertical" &gt;
  
                      &lt;RelativeLayout
                          android:layout_width="match_parent"
                          android:layout_height="32dp"
                          android:id="@+id/relStoreAddress"
                          android:background="@drawable/highlight_rnd_top" &gt;
  
                          &lt;ImageView
                              android:id="@+id/imgIcMap"
                              android:layout_width="wrap_content"
                              android:layout_height="20dp"
                              android:layout_alignParentLeft="true"
                              android:layout_centerHorizontal="true"
                              android:layout_centerVertical="true"
                              android:layout_marginLeft="5dp"
                              android:contentDescription="@drawable/ic_map"
                              android:src="@drawable/ic_map" /&gt;
  
                          &lt;TextView
                              android:id="@+id/txtStoreAddress"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:layout_marginLeft="5dp"
                              android:layout_toRightOf="@+id/imgIcMap"
                              android:layout_centerVertical="true"
                              android:singleLine="true"
                              android:textColor="@color/white"
                              android:textSize="18sp" /&gt;
  
                          &lt;ImageView
                              android:layout_width="wrap_content"
                              android:layout_height="20dp"
                              android:layout_alignParentRight="true"
                              android:layout_centerHorizontal="true"
                              android:layout_centerVertical="true"
                              android:layout_marginRight="2dp"
                              android:contentDescription="@drawable/arrow_white"
                              android:src="@drawable/arrow_white" /&gt;
                      &lt;/RelativeLayout&gt;
  
                      &lt;View
                          android:id="@+id/view2"
                          android:layout_width="fill_parent"
                          android:layout_height="1dp"
                          android:layout_marginBottom="0sp"
                          android:background="@color/line" /&gt;
  
                      &lt;RelativeLayout
                          android:id="@+id/relStoreContact"
                          android:layout_width="match_parent"
                          android:layout_height="34dp"
                          android:background="@drawable/highlight_mid" &gt;
  
                          &lt;ImageView
                              android:id="@+id/imgIcCall"
                              android:layout_width="wrap_content"
                              android:layout_height="20dp"
                              android:layout_marginLeft="5dp"
                              android:layout_alignParentLeft="true"
                              android:layout_centerHorizontal="true"
                              android:layout_centerVertical="true"
                              android:contentDescription="@drawable/ic_call"
                              android:src="@drawable/ic_call" /&gt;
  
                          &lt;TextView
                              android:id="@+id/txtStorePhone"
                              android:layout_toRightOf="@+id/imgIcCall"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:layout_marginLeft="2dp"
                              android:layout_centerVertical="true"
                              android:singleLine="true"
                              android:textColor="@color/white"
                              android:textSize="18sp" /&gt;
  
                          &lt;ImageView
                              android:layout_width="wrap_content"
                              android:layout_height="20dp"
                              android:layout_alignParentRight="true"
                              android:layout_centerHorizontal="true"
                              android:layout_centerVertical="true"
                              android:layout_marginRight="2dp"
                              android:contentDescription="@drawable/arrow_white"
                              android:src="@drawable/arrow_white" /&gt;
                      &lt;/RelativeLayout&gt;
  
                      &lt;View
                          android:id="@+id/view3"
                          android:layout_width="fill_parent"
                          android:layout_height="1dp"
                          android:layout_marginBottom="0sp"
                          android:background="@color/line" /&gt;
  
                      &lt;RelativeLayout
                          android:layout_width="match_parent"
                          android:layout_height="32dp"
                          android:id="@+id/relStoreWeb"
                          android:background="@drawable/highlight_rnd_bottom" &gt;
  
                          &lt;ImageView
                              android:id="@+id/imgIcWeb"
                              android:layout_width="wrap_content"
                              android:layout_height="20dp"
                              android:layout_alignParentLeft="true"
                              android:layout_centerHorizontal="true"
                              android:layout_centerVertical="true"
                              android:layout_marginLeft="5dp"
                              android:contentDescription="@drawable/ic_web"
                              android:src="@drawable/ic_web" /&gt;
  
                          &lt;TextView
                              android:layout_toRightOf="@+id/imgIcWeb"
                              android:id="@+id/txtStoreWebsite"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:layout_centerVertical="true"
                              android:singleLine="true"
                              android:textColor="@color/white"
                              android:textSize="18sp" 
                              android:text="@string/visit_web"/&gt;
  
                          &lt;ImageView
                              android:layout_width="wrap_content"
                              android:layout_height="20dp"
                              android:layout_alignParentRight="true"
                              android:layout_centerHorizontal="true"
                              android:layout_centerVertical="true"
                              android:layout_marginRight="2dp"
                              android:contentDescription="@drawable/arrow_white"
                              android:src="@drawable/arrow_white" /&gt;
                      &lt;/RelativeLayout&gt;
                  &lt;/LinearLayout&gt;
              &lt;/LinearLayout&gt;
          &lt;/RelativeLayout&gt;
  
          &lt;LinearLayout
              android:id="@+id/linDescInfo"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_gravity="top"
              android:layout_marginTop="5dp"
              android:orientation="vertical" &gt;
  
              &lt;include layout="@layout/part_store_sched_tick" /&gt;
  
              &lt;LinearLayout
                  android:id="@+id/linStoreDescTitle"
                  android:layout_width="match_parent"
                  android:layout_height="35dp"
                  android:layout_gravity="center"
                  android:gravity="center|top"
                  android:orientation="vertical"
                  android:layout_marginLeft="5dp"
                  android:layout_marginRight="5dp"
                  android:layout_marginTop="5dp"
                  android:visibility="gone" &gt;
  
                  &lt;TextView
                      android:id="@+id/txtDescTitle"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:background="@drawable/bg_description"
                      android:gravity="center"
                      android:paddingLeft="5dp"
                      android:paddingRight="5dp"
                      android:singleLine="true"
                      android:text="@string/d_desc"
                      android:textColor="@color/white"
                      android:textSize="20sp" /&gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:id="@+id/linStoreDesc"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:layout_gravity="top"
                  android:layout_marginLeft="5dp"
                  android:layout_marginRight="5dp"
                  android:layout_marginTop="5dp"
                  android:background="@drawable/bg_desc"
                  android:gravity="center_horizontal"
                  android:orientation="vertical"
                  android:visibility="gone" &gt;
  
                  &lt;com.dzo.seattlesnightlife.ui.ExpandablePanel
                      android:id="@+id/descPanel"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:orientation="vertical"
                      custom:animationDuration="25"
                      custom:collapsedHeight="80dp"
                      custom:content="@+id/txtDesc"
                      custom:handle="@+id/expand" &gt;
  
                      &lt;TextView
                          android:id="@id/txtDesc"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:layout_gravity="center"
                          android:textSize="18sp"/&gt;
  
                      &lt;View
                          android:id="@+id/view4"
                          android:layout_width="fill_parent"
                          android:layout_height="1dp"
                          android:layout_marginBottom="0sp"
                          android:background="@color/line"/&gt;
  
                      &lt;RelativeLayout
                          android:id="@id/expand"
                          android:layout_width="fill_parent"
                          android:layout_height="wrap_content"
                          android:layout_marginTop="5dp"
                          android:background="@drawable/txt_highlight"
                          android:visibility="gone"&gt;
  
                          &lt;TextView
                              android:id="@+id/txtShowMoreLess"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_centerInParent="true"
                              android:text="@string/show_more"
                              android:textColor="@color/white"
                              android:textSize="18sp"
                              android:textStyle="bold"
                              android:visibility="gone" /&gt;
  
                          &lt;ImageView
                              android:id="@+id/imgMoreLess"
                              android:layout_width="20dp"
                              android:layout_height="20dp"
                              android:layout_centerInParent="true"
                              android:layout_toRightOf="@+id/txtShowMoreLess"
                              android:background="@drawable/arrow_down"
                              android:contentDescription="@drawable/arrow_down"
                              android:visibility="gone" /&gt;
                      &lt;/RelativeLayout&gt;
                  &lt;/com.dzo.seattlesnightlife.ui.ExpandablePanel&gt;
              &lt;/LinearLayout&gt;
  
              &lt;include layout="@layout/part_store_info" /&gt;
  
              &lt;LinearLayout
                  android:id="@+id/linShare"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginLeft="3dp"
                  android:layout_marginRight="3dp"
                  android:layout_marginTop="8dp"
                  android:gravity="top|center_horizontal"
                  android:orientation="vertical" &gt;
  
                  &lt;LinearLayout
                      android:id="@+id/linStoreShareBox"
                      android:layout_width="match_parent"
                      android:layout_height="35dp"
                      android:layout_gravity="top"
                      android:gravity="center_horizontal"
                      android:orientation="vertical" &gt;
  
                      &lt;TextView
                          android:id="@+id/txtStoreShareTittle"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:background="@drawable/bg_description"
                          android:gravity="center|center_vertical"
                          android:paddingLeft="5dp"
                          android:paddingRight="5dp"
                          android:singleLine="true"
                          android:text="@string/d_share"
                          android:textColor="@color/white"
                          android:textSize="20sp" /&gt;
                  &lt;/LinearLayout&gt;
  
                  &lt;include layout="@layout/share_lay_part" /&gt;
              &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/ScrollView&gt;
  
  &lt;com.dzo.seattlesnightlife.ui.FooterBar
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      android:id="@+id/baseFooterBar"/&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Whenever I run my app on large screen device or emulator, I get this weired exception. Going through the stack, when I check line no. 29 in XML, it was <code>android:layout_height</code> for textView. The line no. of activity, on which app crashed was <code>setContentView()</code>. The <code>OutOfMemoryError</code> points that there is problem with my drawables. So, I resized my drawables, but nothing helped me. Can't find out what is actual cause of crash.</p>
  
  <p>My <a href="http://pastie.org/6470102">Java file</a>. Sorry couldn't post it here as it exceeded body limit, I tailored it as it had around 5k lines of code.    </p>
  
  <p>Ok, when I increased heap size to 48 MB app didn't crashed,but with 16 MB heap, it is still crashing. </p>