title: Iam getting android.view.InflateException: Binary XML file line 24: Error inflating class
body: <p>MY Activity_Donar XML file is as follows:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  app:layout_behavior="@string/appbar_scrolling_view_behavior"
  tools:context="com.example.karthi.bloodbankk.MainActivity"
  tools:showIn="@layout/activity_donar"
  android:background="@drawable/bloodbank3"&gt;
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:text="BRING A LIFE BACK TO POWER"
      android:id="@+id/etquote"
      android:layout_alignParentTop="true"
      android:layout_centerHorizontal="true"
      android:textColor="#070707" /&gt;
  
  &lt;EditText
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/etDonarName"
      android:hint="DonorName"
      android:layout_below="@+id/etquote"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:layout_marginTop="175dp"
      android:layout_alignParentRight="true"
      android:layout_alignParentEnd="true" /&gt;
  
  &lt;EditText
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/etBg"
      android:layout_below="@+id/etDonarName"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:layout_alignParentRight="true"
      android:layout_alignParentEnd="true"
      android:hint="Blood Group" /&gt;
  
  &lt;EditText
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/etPhone"
      android:layout_below="@+id/etBg"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:layout_alignParentRight="true"
      android:layout_alignParentEnd="true"
      android:hint="Phone No" /&gt;
  
  &lt;EditText
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/etLocation"
      android:layout_below="@+id/etPhone"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:layout_alignParentRight="true"
      android:layout_alignParentEnd="true"
      android:hint="Location" /&gt;
  
  &lt;EditText
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/etCity"
      android:layout_below="@+id/etLocation"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:layout_alignParentRight="true"
      android:layout_alignParentEnd="true"
      android:hint="City" /&gt;
  
  &lt;Button
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="SUBMIT"
      android:id="@+id/bSubmi"
      android:layout_below="@+id/etCity"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true" /&gt;
  
  &lt;Button
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="SEARCH FOR DONORS"
      android:id="@+id/bSearch"
      android:layout_alignTop="@+id/bSubmi"
      android:layout_alignParentRight="true"
      android:layout_alignParentEnd="true" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>I am getting <code>android.view.InflateException: Binary XML file line 24: Error inflating class</code>. What should I do?
  All my id's for edit texts and buttons in android classes are same as in xml files. But I am unable to get it..</p>
  
  <p>I am getting a
      FATAL EXCEPTION: main</p>
  
  <blockquote>
    <p>Process: com.example.karthi.bloodbankk, PID: 1953
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.karthi.bloodbankk/com.example.karthi.bloodbankk.DonarActivity}: android.view.InflateException: Binary XML file line #24: Binary XML file line #2: Error inflating class 
                                                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                                                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                                     at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                     at android.os.Looper.loop(Looper.java:148)
                                                                                     at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                                  Caused by: android.view.InflateException: Binary XML file line #24: Binary XML file line #2: Error inflating class 
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                                                                                     at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)
                                                                                     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
                                                                                     at com.example.karthi.bloodbankk.DonarActivity.onCreate(DonarActivity.java:39)
                                                                                     at android.app.Activity.performCreate(Activity.java:6237)
                                                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                                                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                                                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                                                     at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                     at android.os.Looper.loop(Looper.java:148) 
                                                                                     at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                                                  Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class 
                                                                                     at android.view.LayoutInflater.createView(LayoutInflater.java:645)
                                                                                     at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
                                                                                     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
                                                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
                                                                                     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:941)
                                                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:831)
                                                                                     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                                                     at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256) 
                                                                                     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109) 
                                                                                     at com.example.karthi.bloodbankk.DonarActivity.onCreate(DonarActivity.java:39) 
                                                                                     at android.app.Activity.performCreate(Activity.java:6237) 
                                                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                                                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                                                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                                                     at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                     at android.os.Looper.loop(Looper.java:148) 
                                                                                     at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                                                  Caused by: java.lang.reflect.InvocationTargetException
                                                                                     at java.lang.reflect.Constructor.newInstance(Native Method)
                                                                                     at android.view.LayoutInflater.createView(LayoutInflater.java:619)
                                                                                     at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) 
                                                                                     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694) 
                                                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762) 
                                                                                     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:941) 
                                                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:831) 
                                                                                     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                                                     at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256) 
                                                                                     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109) 
                                                                                     at com.example.karthi.bloodbankk.DonarActivity.onCreate(DonarActivity.java:39) 
                                                                                     at android.app.Activity.performCreate(Activity.java:6237) 
                                                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                                                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                                                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                                                     at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                     at android.os.Looper.loop(Looper.java:148) 
                                                                                     at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                                                  Caused by: java.lang.OutOfMemoryError: Failed to allocate a 20971532 byte allocation with 4194304 free bytes and 11MB until OOM
                                                                                     at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
                                                                                     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
                                                                                     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
                                                                                     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
                                                                                     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1080)
                                                                                     at android.content.res.Resources.loadDrawableForCookie(Resources.java:2635)
                                                                                     at android.content.res.Resources.loadDrawable(Resources.java:2540)
                                                                                     at android.content.res.TypedArray.getDrawable(TypedArray.java:870)
                                                                                     at android.view.View.(View.java:3948)
                                                                                     at android.view.ViewGroup.(ViewGroup.java:573)
                                                                                     at android.widget.RelativeLayout.(RelativeLayout.java:248)
                                                                                     at android.widget.RelativeLayout.(RelativeLayout.java:244)
                                                                                     at android.widget.RelativeLayout.(RelativeLayout.java:240)
                                                                                     at java.lang.reflect.Constructor.newInstance(Native Method) 
                                                                                     at android.view.LayoutInflater.createView(LayoutInflater.java:619) 
                                                                                     at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) 
                                                                                     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694) 
                                                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762) 
                                                                                     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:941) 
                                                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:831) 
                                                                                     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                                                     at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256) 
                                                                                     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109) 
                                                                                     at com.example.karthi.bloodbankk.DonarActivity.onCreate(DonarActivity.java:39) 
                                                                                     at android.app.Activity.performCreate(Activity.java:6237) 
                                                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                                                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                                                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                                                     at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                     at android.os.Looper.loop(Looper.java:148) 
                                                                                     at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) </p>
  </blockquote>