title: The following classes could not be instantiated: - android.support.v7.widget.Toolbar
body: <p>I am creating an app with the new Material Design used in Android Lollipop (5.0).</p>
  
  <p>I am using the following guides:</p>
  
  <ul>
  <li><a href="http://android-developers.blogspot.it/2014/10/appcompat-v21-material-design-for-pre.html">http://android-developers.blogspot.it/2014/10/appcompat-v21-material-design-for-pre.html</a></li>
  <li><a href="http://antonioleiva.com/material-design-everywhere/">http://antonioleiva.com/material-design-everywhere/</a></li>
  </ul>
  
  <p>After I create my toolbar, I receive this error: "The following classes could not be instantiated:
  - android.support.v7.widget.Toolbar"</p>
  
  <p>The app works well in the phone or emulator, but the layout designer of Android Studio doesn't show the layout correctly.</p>
  
  <p>Here there are some images:</p>
  
  <p>Error in my_awesome_toolbar.xml layout preview
  <img src="https://i.stack.imgur.com/WhY1o.png" alt="error in my_awesome_toolbar.xml"></p>
  
  <p>Error in activity_my.xml layout preview
  <img src="https://i.stack.imgur.com/LV5Oq.png" alt="error in activity_my.xml"></p>
  
  <p>The xml code of the files:</p>
  
  <p>my_awesome_toolbar.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;android.support.v7.widget.Toolbar
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/my_awesome_toolbar"
  android:layout_height="wrap_content"
  android:layout_width="match_parent"
  android:minHeight="?attr/actionBarSize"
  android:background="?attr/colorPrimary" /&gt;
  </code></pre>
  
  <p>activity_my.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"
              android:id="@+id/root"
              tools:context="com.myapp.test.MyActivity"
              android:orientation="horizontal"&gt;
  
      &lt;include
          android:id="@+id/toolbar"
          layout="@layout/my_awesome_toolbar"
          /&gt;
      &lt;!-- Rest of layout --&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>MyActivity.java:</p>
  
  <pre><code>package com.myapp.test;
  
  import android.os.Bundle;
  import android.support.v7.app.ActionBarActivity;
  import android.support.v7.widget.Toolbar;
  import android.view.Menu;
  import android.view.MenuItem;
  
  
  public class MyActivity extends ActionBarActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_my);
  
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          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.my, 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();
          if (id == R.id.action_settings) {
              return true;
          }
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>xml code of the styles (values/styles.xml):</p>
  
  <pre><code>&lt;resources&gt;
  
      &lt;style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"&gt;
          &lt;item name="colorPrimary"&gt;@color/blue&lt;/item&gt;
          &lt;item name="colorPrimaryDark"&gt;@color/dark_blue&lt;/item&gt;
          &lt;item name="actionOverflowButtonStyle"&gt;@style/AppTheme.OverflowButtonStyle&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;!-- Style Title --&gt;
      &lt;style name="Title"&gt;
          &lt;item name="android:textColor"&gt;@color/white&lt;/item&gt;
          &lt;item name="android:textStyle"&gt;bold&lt;/item&gt;
          &lt;item name="android:textSize"&gt;16sp&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="AppTheme.OverflowButtonStyle" parent="Widget.AppCompat.ActionButton.Overflow"&gt;
          &lt;item name="android:src"&gt;@drawable/overflow_icon&lt;/item&gt;
      &lt;/style&gt;
  &lt;/resources&gt;
  </code></pre>
  
  <p>At the moment I use Android Studio Beta 0.8.9</p>