title: AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity
body: <pre><code>AndroidRuntime﹕ FATAL EXCEPTION: main
          Process: com.example.tarun.calculator, PID: 3248
          java.lang.RuntimeException: Unable to start activity
  </code></pre>
  
  <p>I have just created the xml file, And I am using the default MainActivity.java ,but while running I am getting these errors.
  I am new to android programming ,any kind of help will be appreciated.
  Logs</p>
  
  <pre><code>10-07 23:17:28.750    3248-3248/com.example.tarun.calculator E/AndroidRuntime﹕ FATAL EXCEPTION: main
          Process: com.example.tarun.calculator, PID: 3248
          java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.tarun.calculator/com.example.tarun.calculator.MainActivity}: android.view.InflateException: Binary XML file line #7: Binary XML file line #7: Error inflating class android.widget.ImageView
                  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 #7: Binary XML file line #7: Error inflating class android.widget.ImageView
                  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:255)
                  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
                  at com.example.tarun.calculator.MainActivity.onCreate(MainActivity.java:13)
                  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 #7: Error inflating class android.widget.ImageView
                  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.createViewFromTag(LayoutInflater.java:704)
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
                  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:255)
                  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
                  at com.example.tarun.calculator.MainActivity.onCreate(MainActivity.java:13)
                  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.createViewFromTag(LayoutInflater.java:704)
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
                  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:255)
                  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
                  at com.example.tarun.calculator.MainActivity.onCreate(MainActivity.java:13)
                  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 74649612 byte allocation with 1048576 free bytes and 63MB 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.widget.ImageView.&lt;init&gt;(ImageView.java:152)
                  at android.widget.ImageView.&lt;init&gt;(ImageView.java:140)
                  at android.widget.ImageView.&lt;init&gt;(ImageView.java:136)
                  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.createViewFromTag(LayoutInflater.java:704)
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
                  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:255)
                  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
                  at com.example.tarun.calculator.MainActivity.onCreate(MainActivity.java:13)
                  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)
  </code></pre>
  
  <p>activity_main.xml</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MainActivity"&gt;
  
      &lt;ImageView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:scaleType="centerCrop"
          android:src="@drawable/transform"
  
          /&gt;
  
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical"
  
          &gt;
  
          &lt;TextView
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_marginTop="20dp"
              android:background="#59ffffff"
              android:textSize="60dp"
               android:text="@string/hello_world"
              android:textColor="#ffffff"
              android:gravity="center"
              android:layout_weight="1"
  
          /&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:orientation="horizontal"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              &gt;
  
              &lt;Button
                  android:layout_weight="1"
                  android:text="1"
                  android:textSize="40sp"
                  android:background="#66ffffff"
                  android:layout_height="match_parent"
                  android:layout_width="wrap_content" /&gt;
  
              &lt;Button
                  android:layout_width="wrap_content"
                  android:layout_weight="1"
                  android:text="2"
                  android:textSize="40sp"
                  android:background="#66ffffff"
                  android:layout_height="match_parent"
  
                  /&gt;
  
              &lt;Button
                  android:layout_width="wrap_content"
                  android:layout_weight="1"
                  android:text="3"
                  android:textSize="40sp"
                  android:background="#66ffffff"
                  android:layout_height="match_parent"
  
                  /&gt;
  
              &lt;Button
                  android:layout_width="wrap_content"
                  android:layout_weight="1"
                  android:text="*"
                  android:textSize="40sp"
                  android:background="#66ffffff"
                  android:layout_height="match_parent"
  
                  /&gt;
  
  
          &lt;/LinearLayout&gt;
  
  
  
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:orientation="horizontal"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              &gt;
  
              &lt;Button
                  android:layout_weight="1"
  
                  android:text="4"
                  android:textSize="40sp"
                  android:background="#66ffffff"
  
                  android:layout_height="match_parent"
  
                  android:layout_width="wrap_content" /&gt;
              &lt;Button
                  android:layout_width="wrap_content"
                  android:layout_weight="1"
                  android:text="5"
                  android:textSize="40sp"
                  android:background="#66ffffff"
  
                  android:layout_height="match_parent"
  
                  /&gt;
  
              &lt;Button
                  android:layout_width="wrap_content"
                  android:layout_weight="1"
                  android:text="6"
                  android:textSize="40sp"
                  android:background="#66ffffff"
                  android:layout_height="match_parent"
  
                  /&gt;
  
              &lt;Button
                  android:layout_width="wrap_content"
                  android:layout_weight="1"
                  android:text="/"
                  android:textSize="40sp"
                  android:background="#66ffffff"
                  android:layout_height="match_parent"
  
                  /&gt;
  
  
          &lt;/LinearLayout&gt;
  
  
  
  
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:orientation="horizontal"
              android:layout_height="wrap_content"
              android:layout_weight="1"
  
              &gt;
  
              &lt;Button
                  android:layout_weight="1"
  
                  android:text="7"
  
                  android:layout_height="match_parent"
                  android:textSize="40sp"
                  android:background="#66ffffff"
                  android:layout_width="wrap_content" /&gt;
  
  
              &lt;Button
                  android:layout_width="wrap_content"
                  android:layout_weight="1"
                  android:text="8"
                  android:textSize="40sp"
                  android:background="#66ffffff"
                  android:layout_height="match_parent"
  
                  /&gt;
  
              &lt;Button
                  android:layout_width="wrap_content"
                  android:layout_weight="1"
                  android:text="9"
                  android:textSize="40sp"
                  android:background="#66ffffff"
                  android:layout_height="match_parent"
  
                  /&gt;
  
              &lt;Button
                  android:layout_width="wrap_content"
                  android:layout_weight="1"
                  android:text="-"
                  android:textSize="40sp"
                  android:background="#66ffffff"
                  android:layout_height="match_parent"
  
                  /&gt;
  
  
          &lt;/LinearLayout&gt;
  
  
  
  
  
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:orientation="horizontal"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              &gt;
  
              &lt;Button
                  android:layout_weight="1"
  
                  android:text="."
                  android:textSize="40sp"
                  android:background="#66ffffff"
  
                  android:layout_height="match_parent"
  
                  android:layout_width="wrap_content" /&gt;
              &lt;Button
                  android:layout_width="wrap_content"
                  android:layout_weight="1"
                  android:text="0"
                  android:textSize="40sp"
                  android:background="#66ffffff"
                  android:layout_height="match_parent"
  
                  /&gt;
  
              &lt;Button
                  android:layout_width="wrap_content"
                  android:layout_weight="1"
                  android:text="+"
                  android:textSize="40sp"
                  android:background="#66ffffff"
                  android:layout_height="match_parent"
  
                  /&gt;
  
              &lt;Button
                  android:layout_width="wrap_content"
                  android:layout_weight="1"
                  android:text="="
                  android:textSize="40sp"
                  android:background="#66ffffff"
                  android:layout_height="match_parent"
  
                  /&gt;
  
  
          &lt;/LinearLayout&gt;
  
  
  
  
  
  
  
  
  
  
      &lt;/LinearLayout&gt;
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>MainActivity.java</p>
  
  <pre><code>package com.example.tarun.helloworld;
  
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>