title: Android- my app crashes immediately I try to run on my AVD
body: <p>I have been learning android app development with a personal challenge of a     tax app. I don't see any error in the text editor but anytime I run the app on   my AVD, the app crashes even before i see the launch page.</p>
  
  <p>MY Manifest file</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.example.lorlormensah.taxapp"&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
          &lt;activity
              android:name=".MainActivity"
              android:label="@string/app_name"
              android:theme="@style/AppTheme.NoActionBar"&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>My mainActivity</p>
  
  <pre><code>    package com.example.lorlormensah.taxapp;
  
      import android.app.ActionBar;
      import android.os.Bundle;
      import android.support.design.widget.FloatingActionButton;
      import android.support.design.widget.Snackbar;
      import android.support.v7.app.AppCompatActivity;
      import android.support.v7.widget.Toolbar;
      import android.view.View;
      import android.view.Menu;
      import android.view.MenuItem;
      import android.view.ViewGroup;
      import android.widget.Button;
      import android.widget.EditText;
      import android.widget.LinearLayout;
  
      public class MainActivity extends AppCompatActivity  implements View.OnClickListener{
  
  
  
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
  
          }
  
          EditText salary = (EditText) findViewById(R.id.edit_salary);
          EditText allowance = (EditText) findViewById(R.id.edit_allowance);
          EditText incomeTax = (EditText) findViewById(R.id.IncTax_edit);
          EditText payable = (EditText) findViewById(R.id.payable_edit);
          EditText totalTax = (EditText) findViewById(R.id.deduction_edit);
          Button calculate = (Button) findViewById(R.id.calculate_button);
          final double taxRate = 0.5;
          double tax;
  
  
          double realSalary,realAllowance, taxPayable, sniit,firstTax,taxes, levelTax,taxable;
  
  
          // @Override
          public void onClick (View v) {
  
              calculate.setOnClickListener(new Button.OnClickListener() {
  
  
                  @Override
                  public void onClick(View v) {
  
                      realSalary = Double.parseDouble(salary.getText().toString());
                      realAllowance = Double.parseDouble(allowance.getText().toString());
  
                      //if(v ==calculate){
  
                      getSnit();
  
                      getTaxable();
  
                      computeTaxes();
                  }
                  // }
  
                  public double getSnit() {
  
  
                      sniit = realSalary * 0.055;
  
  
                      return sniit;
                  }
  
                  // CALCULATING THE TAXABLE AFTER SNIIT
  
                  public double getTaxable() {
                      if (realSalary &lt;= 216) {
  
                      } else {
                          taxable = realSalary - sniit;
                      }
  
                      return taxable;
  
                  }
  
                  public double computeTaxes() {
  
                      //SOLVING FOR THE SECOND LEVEL(2ND) LEVEL
                      if (taxable &gt; 216 &amp;&amp; taxable &lt;= 324) {
                          levelTax = taxable - 216;
                          firstTax = levelTax * 0.05;
                          System.out.println(levelTax);
                          taxes = 0.0 + firstTax;
                          payable.setText("" + taxes);
  
                          //SOLVING FOR THE THIRD(3RD) LEVEL
                      } else if (taxable &gt; 324 &amp;&amp; taxable &lt;= 475) {
                          levelTax = taxable - (216 + 108);
                          firstTax = levelTax * 0.10;
                          System.out.println(levelTax);
                          taxes = 0 + 5.40 + firstTax;
                          payable.setText("" + taxes);
  
                          //SOLVING FOR THE FOURTH(4TH) LEVEL
                      } else if (taxable &gt; 324 &amp;&amp; taxable &lt;= 3240) {
                          levelTax = taxable - (216 + 108 + 151);
                          firstTax = levelTax * 0.175;
                          System.out.println(levelTax);
                          taxes = 0 + 5.40 + 15.10 + firstTax;
                          payable.setText("" + taxes);
  
                          //SOLVING FOR THE FIFTH(5TH) LEVEL
                      } else if (taxable &gt; 3240) {
                          levelTax = taxable - (216 + 108 + 151 + 2765);
                          firstTax = levelTax * 0.25;
                          //System.out.println("First tax2 " + levelTax);
  
                          taxes = 0 + 5.40 + 15.10 + 483.88 + firstTax;
                          payable.setText("" + taxes);
  
  
                      }
                      // else {
                      //System.out.println("Your salary is tax free");
                      //  }
                      return taxes;
                  }
  
  
              });
          }
      }
  </code></pre>
  
  <p>errors i get</p>
  
  <pre><code>02-21 17:55:20.314 915-915/com.example.lorlormensah.taxapp D/AndroidRuntime: Shutting down VM
  02-21 17:55:20.314 915-915/com.example.lorlormensah.taxapp W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41465730)
  02-21 17:55:20.343 915-915/com.example.lorlormensah.taxapp E/AndroidRuntime: FATAL EXCEPTION: main
                                                                               java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.lorlormensah.taxapp/com.example.lorlormensah.taxapp.MainActivity}: java.lang.NullPointerException
                                                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
                                                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
                                                                                   at android.app.ActivityThread.access$600(ActivityThread.java:141)
                                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
                                                                                   at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                   at android.os.Looper.loop(Looper.java:137)
                                                                                   at android.app.ActivityThread.main(ActivityThread.java:5103)
                                                                                   at java.lang.reflect.Method.invokeNative(Native Method)
                                                                                   at java.lang.reflect.Method.invoke(Method.java:525)
                                                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
                                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
                                                                                   at dalvik.system.NativeStart.main(Native Method)
                                                                                Caused by: java.lang.NullPointerException
                                                                                   at android.app.Activity.findViewById(Activity.java:1853)
                                                                                   at com.example.lorlormensah.taxapp.MainActivity.&lt;init&gt;(MainActivity.java:28)
                                                                                   at java.lang.Class.newInstanceImpl(Native Method)
                                                                                   at java.lang.Class.newInstance(Class.java:1130)
                                                                                   at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
                                                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
                                                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 
                                                                                   at android.app.ActivityThread.access$600(ActivityThread.java:141) 
                                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 
                                                                                   at android.os.Handler.dispatchMessage(Handler.java:99) 
                                                                                   at android.os.Looper.loop(Looper.java:137) 
                                                                                   at android.app.ActivityThread.main(ActivityThread.java:5103) 
                                                                                   at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                                   at java.lang.reflect.Method.invoke(Method.java:525) 
                                                                                   at `enter code here`com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
                                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
                                                                                   at dalvik.system.NativeStart.main(Native Method) 
  02-21 17:55:22.624 915-915/? I/Process: Sending signal. PID: 915 SIG: 9
  </code></pre>