8

I'm new to android programming. Here is the issue I'm facing:-

I followed the xml code for toolbar from http://android-developers.blogspot.com/2014/10/appcompat-v21-material-design-for-pre.html and applied into Eclipse. I received this message:

"The following classes could not be instantiated: - android.support.v7.widget.Toolbar (Open Class, Show Error Log) See the Error Log (Window > Show View) for more details."

May I ask any idea how to solve this issue? Thanks!

DanKCl
  • 389
  • 2
  • 7
  • 18

1 Answers1

1

If you are targeting Android 22, then make your MainActivity extend from AppCompatActivity instead of ActionBarActivity. Then rebuild your gradle project and voila!

The only other possible solution I found is to switch SDK version to 21 in the upper-right (green android guy) of the Preview window.

IgorGanapolsky
  • 26,189
  • 23
  • 116
  • 147