Cannot resolve symbol AppCompatActivity – Support v7 libraries aren't recognized?

I’m trying to figure out why the heck my Android studio isn’t recognizing the AppCompat v7 library correctly. The import statement below shows up as gray and says there’s no package for Below is my activity file:


public class XApplicationActivity extends AppCompatActivity

My build.grade:

  • Add elevation/shadow on toolbar for pre-lollipop devices
  • Android create selector programmatically
  • Transfering data using ultrasound
  • how to change video orientation in MediaRecorder to portrait
  • Change background color of selected item on a ListView
  • How to tell if GPS is enabled on Android using Titanium
  • compile ""

    My project settings:

    minSdkVersion = 14
    targetSdkVersion = 21
    compileSdkVersion = 21
    buildToolsVersion = "22.0.1"

    So I’m really confused as to why this is still giving me issues. Things I’ve tried already:

    • Cleaning/rebuilding the project
    • Invalidating caches and restarting
    • Checking a billion times to make sure I have the support library installed (I absolutely do have the latest support repository and libraries installed)

    Anybody know of any fixes? It’s cost me a lot of time and it’s really frustrating.

    Related posts:

    Writing backwards compatible Android code
    Android Resource Qualifiers -sw#dp vs -w#dp
    how to change number picker style in android?
    Shape Drawables on Samsung devices default to black background
    List Filter Custom Adapter dont give result
    Get back key event on EditText
  • How to remove Rendering Problems message window in Intellij IDEA 13 layout preview
  • Edit an AndroidManifest when compiling to remove API-key
  • Issue with ComposeShader on Android 4.1.1
  • Android, This API is marked as internal to the support library and should not be accessed from apps error
  • Changing thread priority doesn't have an effect
  • Get language in android?
  • 6 Solutions collect form web for “Cannot resolve symbol AppCompatActivity – Support v7 libraries aren't recognized?”

    For me,
    Even after upgrading to appcompat-v7:22.1.0, in which AppCompatActivty is added,
    the problem was not resolved for me, Android Studio was giving same problem

    Cannot resolve symbol ‘AppCompatActivity’

    Sometimes clearing the android studio caches help.

    In android studio I just cleared the caches and restarted with the following option–

    File->Invalidate Caches/Restart

    AppCompatActivity was only added in version 22.1.0 of the support library. Before that it was called ActionBarActivity.

    You should use the same version for all of your support libraries. At the time of writing the latest version is 23.1.1 (you can find out the latest here so the dependencies section of your gradle file should look like this.

    compile ""
    compile ""
    compile ""

    Okay, I fixed it by rebuilding it for doing a ./gradlew clean assemble for the fourth time… Android Studio is a weird thing

    We don´t need to delete files, just invalidate caches to restart configuration:

    introducir la descripción de la imagen aquí

    I got the same exact error with In case it helps others .. documenting what worked for me useful for very latest (Jan 14, 2017) latest everything. Tried all the Invalidate, build clean, even deleting .gradle/, tweaking the support libs etc.. on multiple stack overflow answers.

    I found that upgrading the settings.gradle gradle version fixed it (it was 2.1.3) something in gradle toolchain seems to
    classpath ‘’

    I changed from “… extends ActionBarActivity” to “… extends AppCompatActivity” and tried cleaning, restarting, Invalidate Caches / Restart and wasn’t getting anywhere. All my versions were up to the latest.

    What finally solved it was making sure my import was correct:


    For some reason it didn’t get set up automatically like I was used to and I had to add it manually.

    Hope that helps someone!

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.