javaandroidandroid-actionbaractivity

ActionBarActivity: cannot be resolved to a type


I am new to android-programming. I am following this tutorial to add an ActionBar to my Main_Activity using the explanation in the "Support Android 2.1 and Above" section.

I followed this tutorial to add a Library-Project. Then after adding the library, at the point "Add the library to your application project: I felt lost .. basically because I don't have the "add" option by itself in my Eclipse ..

however I clicked on "add library" and moved on ..

now when I change Activity to ActionBarActivity :

public class MainActivity extends ActionBarActivity { ... }

in my mainActivity.java , it gives me error (a red line bellow the ActionBarActivity and all methods' names and some functions) .. and again when i change:

<activity android:theme="@style/Theme.AppCompat.Light" ... >

in the Manifest, it also give me an error saying: No resource found that matches the given name ..

I am totally lost .. what did I do wrong ?


Solution

  • It does not sound like you imported the library right especially when you say at the point Add the library to your application project: I felt lost .. basically because I don't have the "add" option by itself .. however I clicked on "add library" and moved on ..

    in eclipse you need to right click on the project, go to Properties, select Android in the list then Add to add the library

    follow this tutorial in the docs

    http://developer.android.com/tools/support-library/setup.html