Search code examples
androidandroid-studioandroid-actionbar-compat

Can't import ActionBarCompat from Android Support Library using Android Studio


I am using Android Studio and have followed this article from google as well as some other articles discussing how to use the new ActionBarCompat.

I have downloaded the support library (Rev. 18) in Android SDK Manager and added the following in my build.gradle

dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile 'com.android.support:appcompat-v7:18.0.0'
}

Now I'm trying to import the Support Library API and extend ActionBarActivity in my code, however, this is what showed up

enter image description here enter image description here

which is not what it is supposed to be

import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;

Any Help?


Solution

  • I have the same problem. I followed this step to solved it, in Android Studio - Tools -> Android -> Sync Project with Gradle Files.

    enter image description here

    Edit: Sorry, I forgot add this: After Sync Project with Gradle Files follow this steps:

    • Right mouse click for your project and select Open Module Settings

    enter image description here

    • After that, select dependencies tab

    enter image description here

    • In the end - selec your library:

    enter image description here

    This should work.