title: Another FATAL EXCEPTION MAIN in android programming
body: <p>I looked up other similar questions and couldn't find a solution, so here I am.
  I am a complete beginner in Java and android programming, even though I have a quite good knowledge of C and basic knowledge of C++ and Python, as well as a few more specific programs like Mathematica and ROOT.</p>
  
  <p>I tried making an extremely simple android app: a number displayed and two buttons which raise or decrease the number, but I get tons of errors. If you kindly have time to help me, I feel really discouraged by this first impact.</p>
  
  <p><strong>This is my .xml file:</strong></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"
      android:background="@style/AppTheme"
      android:orientation="vertical"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context=".StartActivity" &gt;
  
  
      &lt;TextView
  
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="@string/text1"
          android:textSize="45sp"
          android:layout_gravity="center"
          android:gravity="center"
          android:id="@+id/tvDisplay"
          /&gt;
  
       &lt;Button
           android:id="@+id/bSub"
           android:layout_width="250sp"
           android:layout_height="wrap_content"
           android:layout_alignParentLeft="true"
           android:layout_centerVertical="true"
           android:text="@string/button2"
           android:textSize="20sp" /&gt;
  
       &lt;Button
           android:id="@+id/bAdd"
           android:layout_width="250sp"
           android:layout_height="wrap_content"
           android:layout_alignLeft="@+id/tvDisplay"
           android:layout_below="@+id/tvDisplay"
           android:layout_marginTop="30dp"
           android:text="@string/button1"
           android:textSize="20sp" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>And this is my .java file:</strong></p>
  
  <pre><code>package com.appdiprova.giovanni;
  
  import android.os.Bundle;
  import android.app.Activity;
  import android.view.Menu;
  import android.view.View;
  import android.widget.Button;
  import android.widget.TextView;
  
  public class StartActivity extends Activity {
  
      int counter; 
      Button add,sub;
      TextView display;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_start);
          counter=0;
          add= (Button) findViewById(R.id.bAdd);
          sub= (Button) findViewById(R.id.bSub);
          display = (TextView) findViewById(R.id.tvDisplay);
  
          add.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  // TODO Auto-generated method stub
                  counter=counter+1;
                  display.setText("Your total is " + counter);
              }
          });
          sub.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  // TODO Auto-generated method stub
                  counter=counter-1;
                  display.setText("Your total is " + counter);
              }
          });
      }
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.start, menu);
          return true;
      }
  
  }
  </code></pre>
  
  <p>As I run the program I get in the LogCat a long list of errors, the first of which tells me FATAL EXCEPTION MAIN.</p>
  
  <p>How can I solve this? 
  Thank you very much</p>
  
  <p><strong>EDIT</strong>
  I'm sorry, I'll post also the manifest and the LogCat</p>
  
  <p><strong>Manifest</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.appdiprova.giovanni"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="15"
          android:targetSdkVersion="19" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name="com.appdiprova.giovanni.StartActivity"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>Ok I am fairly confused, since now I don't get FATAL ECEPTION anymore, but still a lot of errors:</p>
  
  <pre><code>11-15 08:39:35.410: E/SoundPool(370): error loading /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:35.410: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:35.420: E/SoundPool(370): error loading /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:35.420: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:35.420: E/SoundPool(370): error loading /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:35.420: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:35.420: E/SoundPool(370): error loading /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:35.420: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:35.430: E/SoundPool(370): error loading /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:35.430: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:35.430: E/SoundPool(370): error loading /system/media/audio/ui/KeypressStandard.ogg
  11-15 08:39:35.430: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/KeypressStandard.ogg
  11-15 08:39:35.450: E/SoundPool(370): error loading /system/media/audio/ui/KeypressSpacebar.ogg
  11-15 08:39:35.450: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/KeypressSpacebar.ogg
  11-15 08:39:35.450: E/SoundPool(370): error loading /system/media/audio/ui/KeypressDelete.ogg
  11-15 08:39:35.450: I/ActivityManager(370): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.appdiprova.giovanni/.StartActivity} from pid 546
  11-15 08:39:35.460: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/KeypressDelete.ogg
  11-15 08:39:35.460: E/SoundPool(370): error loading /system/media/audio/ui/KeypressReturn.ogg
  11-15 08:39:35.470: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg
  11-15 08:39:35.470: E/SoundPool(370): error loading /system/media/audio/ui/KeypressInvalid.ogg
  11-15 08:39:35.470: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/KeypressInvalid.ogg
  11-15 08:39:35.470: W/AudioService(370): onLoadSoundEffects(), Error -1 while loading samples
  11-15 08:39:35.560: E/gralloc_goldfish(50): gralloc_alloc: Mismatched usage flags: 246 x 410, usage 333
  11-15 08:39:35.560: W/GraphicBufferAllocator(50): alloc(246, 410, 1, 00000333, ...) failed -22 (Invalid argument)
  11-15 08:39:35.560: E/(50): GraphicBufferAlloc::createGraphicBuffer(w=246, h=410) failed (Invalid argument), handle=0x0
  11-15 08:39:35.560: E/BufferQueue(370): [ScreenshotClient] dequeueBuffer: SurfaceComposer::createGraphicBuffer failed
  11-15 08:39:35.570: W/WindowManager(370): Screenshot failure taking screenshot for (246x410) to layer 21005
  11-15 08:39:35.780: D/LightsService(370): Excessive delay setting light: 392ms
  11-15 08:39:35.850: D/dalvikvm(924): Not late-enabling CheckJNI (already on)
  11-15 08:39:35.870: I/ActivityManager(370): Start proc com.appdiprova.giovanni for activity com.appdiprova.giovanni/.StartActivity: pid=924 uid=10051 gids={50051}
  11-15 08:39:36.610: D/AndroidRuntime(924): Shutting down VM
  11-15 08:39:36.610: W/dalvikvm(924): threadid=1: thread exiting with uncaught exception (group=0xb3ad1b90)
  11-15 08:39:36.630: E/AndroidRuntime(924): FATAL EXCEPTION: main
  11-15 08:39:36.630: E/AndroidRuntime(924): Process: com.appdiprova.giovanni, PID: 924
  11-15 08:39:36.630: E/AndroidRuntime(924): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.appdiprova.giovanni/com.appdiprova.giovanni.StartActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.app.ActivityThread.access$700(ActivityThread.java:135)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.os.Handler.dispatchMessage(Handler.java:102)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.os.Looper.loop(Looper.java:137)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.app.ActivityThread.main(ActivityThread.java:4998)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at java.lang.reflect.Method.invokeNative(Native Method)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at java.lang.reflect.Method.invoke(Method.java:515)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at dalvik.system.NativeStart.main(Native Method)
  11-15 08:39:36.630: E/AndroidRuntime(924): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.view.LayoutInflater.createView(LayoutInflater.java:620)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.app.Activity.setContentView(Activity.java:1928)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at com.appdiprova.giovanni.StartActivity.onCreate(StartActivity.java:20)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.app.Activity.performCreate(Activity.java:5243)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
  11-15 08:39:36.630: E/AndroidRuntime(924):  ... 11 more
  11-15 08:39:36.630: E/AndroidRuntime(924): Caused by: java.lang.reflect.InvocationTargetException
  11-15 08:39:36.630: E/AndroidRuntime(924):  at java.lang.reflect.Constructor.constructNative(Native Method)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.view.LayoutInflater.createView(LayoutInflater.java:594)
  11-15 08:39:36.630: E/AndroidRuntime(924):  ... 23 more
  11-15 08:39:36.630: E/AndroidRuntime(924): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f060001 a=-1 r=0x7f060001}
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.content.res.Resources.loadDrawable(Resources.java:2068)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.view.View.&lt;init&gt;(View.java:3545)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.view.View.&lt;init&gt;(View.java:3475)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:464)
  11-15 08:39:36.630: E/AndroidRuntime(924):  at android.widget.RelativeLayout.&lt;init&gt;(RelativeLayout.java:236)
  11-15 08:39:36.630: E/AndroidRuntime(924):  ... 26 more
  11-15 08:39:36.650: W/ActivityManager(370):   Force finishing activity com.appdiprova.giovanni/.StartActivity
  11-15 08:39:37.050: I/WindowManager(370): Screenshot max retries 4 of Token{b40edef0 ActivityRecord{b40edd90 u0 com.appdiprova.giovanni/.StartActivity t3 f}} appWin=Window{b41b27f0 u0 Starting com.appdiprova.giovanni} drawState=4
  11-15 08:39:37.050: W/WindowManager(370): Screenshot failure taking screenshot for (480x800) to layer 21010
  11-15 08:39:37.560: W/ActivityManager(370): Activity pause timeout for ActivityRecord{b40edd90 u0 com.appdiprova.giovanni/.StartActivity t3 f}
  11-15 08:39:37.900: W/EGL_emulation(546): eglSurfaceAttrib not implemented
  11-15 08:39:38.640: E/SoundPool(370): error loading /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:38.640: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:38.640: E/SoundPool(370): error loading /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:38.640: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:38.640: E/SoundPool(370): error loading /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:38.650: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:38.650: E/SoundPool(370): error loading /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:38.650: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:38.650: E/SoundPool(370): error loading /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:38.650: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
  11-15 08:39:38.680: E/SoundPool(370): error loading /system/media/audio/ui/KeypressStandard.ogg
  11-15 08:39:38.680: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/KeypressStandard.ogg
  11-15 08:39:38.710: E/SoundPool(370): error loading /system/media/audio/ui/KeypressSpacebar.ogg
  11-15 08:39:38.710: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/KeypressSpacebar.ogg
  11-15 08:39:38.720: E/SoundPool(370): error loading /system/media/audio/ui/KeypressDelete.ogg
  11-15 08:39:38.720: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/KeypressDelete.ogg
  11-15 08:39:38.720: E/SoundPool(370): error loading /system/media/audio/ui/KeypressReturn.ogg
  11-15 08:39:38.720: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg
  11-15 08:39:38.730: E/SoundPool(370): error loading /system/media/audio/ui/KeypressInvalid.ogg
  11-15 08:39:38.730: W/AudioService(370): Soundpool could not load file: /system/media/audio/ui/KeypressInvalid.ogg
  11-15 08:39:38.730: W/AudioService(370): onLoadSoundEffects(), Error -1 while loading samples
  11-15 08:39:38.800: I/Process(924): Sending signal. PID: 924 SIG: 9
  11-15 08:39:38.800: W/InputMethodManagerService(370): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@b41dee38 attribute=null, token = android.os.BinderProxy@b4048d78
  11-15 08:39:38.830: I/ActivityManager(370): Process com.appdiprova.giovanni (pid 924) has died.
  11-15 08:39:42.300: D/MobileDataStateTracker(370): default: setPolicyDataEnable(enabled=true)
  11-15 08:39:43.530: E/NetdConnector(370): NDC Command {47 bandwidth setiquota eth0 9223372036854775807} took too long (782ms)
  </code></pre>