title: setSupportActionBar(Toolbar toolbar) not working in my material project
body: <p>Hi everyone i have been facing this problem for couple of days now. I have googled and stackoverflowed but no one has precise solution for this question.</p>
  
  <p>Am a beginner in android material design. Am trying to create a Toolbar for my app, however once in use <code>setSupportActionBar(Toolbar toolbar)</code>, the app crashes, when i get rid of <code>setSupportActionBar(Toolbar toolbar)</code> the application runs and does not crash</p>
  
  <p>This is my code.. </p>
  
  <p>build.gradle(Module:App)</p>
  
  <pre><code>`apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 22
      buildToolsVersion "23.0.0 rc3"
  
      defaultConfig {
          applicationId "com.example.benson.bestqsystems"
          minSdkVersion 9
          targetSdkVersion 22
          versionCode 1
          versionName "1.0"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      compile 'com.android.support:appcompat-v7:22.2.1'
  }
  `
  </code></pre>
  
  <p>styles.xml</p>
  
  <pre><code>    `&lt;resources&gt;
  
      &lt;!-- Base application theme. --&gt;
      &lt;style name="AppTheme" parent="AppTheme.Base"&gt;
          &lt;!-- Customize your theme here. --&gt;
      &lt;/style&gt;
  
      &lt;style name="AppTheme.Base" parent="Theme.AppCompat.NoActionBar"&gt;
          &lt;item name="colorPrimary"&gt;@color/colorPrimary&lt;/item&gt;
          &lt;item name="colorPrimaryDark"&gt;@color/colorPrimaryDark&lt;/item&gt;
          &lt;item name="colorAccent"&gt;@color/colorAccent&lt;/item&gt;
      &lt;/style&gt;
  &lt;/resources&gt;
  `
  </code></pre>
  
  <p>style.xml for v21</p>
  
  <pre><code>    `&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources&gt;
      &lt;style name="AppTheme" parent="AppTheme.Base"&gt;
          &lt;item name="android:colorPrimary"&gt;@color/colorPrimary&lt;/item&gt;
          &lt;item name="android:colorPrimaryDark"&gt;@color/colorPrimaryDark&lt;/item&gt;
          &lt;item name="android:colorAccent"&gt;@color/colorAccent&lt;/item&gt;
      &lt;/style&gt;
  &lt;/resources&gt;
  `
  </code></pre>
  
  <p>my_app_bar.xml (Contains the layout for my Toolbar)</p>
  
  <pre><code>`&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v7.widget.Toolbar
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:minHeight="?attr/actionBarSize"
      android:background="?attr/colorPrimary"
      android:id="@+id/app_bar"
      xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
  &lt;/android.support.v7.widget.Toolbar&gt;`
  </code></pre>
  
  <p>main_activity layout:</p>
  
  <pre><code>`&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"&gt;
  
      &lt;include layout="@layout/my_app_bar"
  
          /&gt;
  
      &lt;TextView
          android:id="@+id/textView"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center_horizontal"
          android:padding="10dp"
          android:text="Large Text"
          android:textAppearance="?android:attr/textAppearanceLarge"
          android:textSize="35sp" /&gt;
  
      &lt;Button
          android:id="@+id/testing"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center_horizontal"
          android:text="move to second acitivity" /&gt;
  &lt;/LinearLayout&gt;
  `
  </code></pre>
  
  <p>MainActivity.java:</p>
  
  <pre><code>`package com.example.benson.bestqsystems;
  
  import android.content.Intent;
  import android.support.v7.app.ActionBarActivity;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.support.v7.widget.Toolbar;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.Button;
  
  import java.security.MessageDigestSpi;
  
  public class MainAcitvity extends AppCompatActivity implements View.OnClickListener{
      private Button move;
      private Toolbar toolbar;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main_acitvity);
          move = (Button) findViewById(R.id.testing);
          move.setOnClickListener(this);
          setSupportActionBar(toolbar);
  
      }
  
      @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_acitvity, 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);
      }
  
      @Override
      public void onClick(View v) {
          switch(v.getId()){
              case R.id.testing:
                  Message.message(this, "testing please");
                  startActivity(new Intent(this, Second.class));
                  break;
          }
      }
  }
  `
  </code></pre>
  
  <p>AndroidManifest.xml</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.benson.bestqsystems" &gt;
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name=".MainAcitvity"
              android:label="@string/title_activity_main_acitvity" &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;activity
              android:name=".Second"
              android:label="@string/title_activity_second" &gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  `
  </code></pre>
  
  <p>After running my application this is my logcat</p>
  
  <pre><code>`java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.benson.bestqsystems/com.example.benson.bestqsystems.MainAcitvity}: java.lang.NullPointerException
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
              at android.app.ActivityThread.access$600(ActivityThread.java:123)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
              at android.os.Handler.dispatchMessage(Handler.java:99)
              at android.os.Looper.loop(Looper.java:137)
              at android.app.ActivityThread.main(ActivityThread.java:4424)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:511)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
              at dalvik.system.NativeStart.main(Native Method)
       Caused by: java.lang.NullPointerException
              at android.support.v7.internal.widget.ToolbarWidgetWrapper.&lt;init&gt;(ToolbarWidgetWrapper.java:94)
              at android.support.v7.internal.widget.ToolbarWidgetWrapper.&lt;init&gt;(ToolbarWidgetWrapper.java:87)
              at android.support.v7.internal.app.ToolbarActionBar.&lt;init&gt;(ToolbarActionBar.java:77)
              at android.support.v7.app.AppCompatDelegateImplV7.setSupportActionBar(AppCompatDelegateImplV7.java:198)
              at android.support.v7.app.AppCompatActivity.setSupportActionBar(AppCompatActivity.java:96)
              at com.example.benson.bestqsystems.MainAcitvity.onCreate(MainAcitvity.java:24)
              at android.app.Activity.performCreate(Activity.java:4465)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1051)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
              at android.app.ActivityThread.access$600(ActivityThread.java:123)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
              at android.os.Handler.dispatchMessage(Handler.java:99)
              at android.os.Looper.loop(Looper.java:137)
              at android.app.ActivityThread.main(ActivityThread.java:4424)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:511)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
              at dalvik.system.NativeStart.main(Native Method)`
  </code></pre>
  
  <p>Anyone to help, I will appreciate  so much.</p>