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 support.v7.app. Below is my activity file:

import android.support.v7.app.AppCompatActivity;


public class XApplicationActivity extends AppCompatActivity

My build.grade:

  • Modify AIRPLANE_MODE_ON on Android 4.2 (and above)
  • Emulator for Amazon Kindle
  • Can't use srcCompat for ImageViews in android
  • Android Studio suddenly cannot resolve symbols
  • What does FragmentManager and FragmentTransaction exactly do?
  • ListView not expanding inside NestedScrollView
  • compile "com.android.support:appcompat-v7:22.0.0"
    compile "com.android.support:support-annotations:$ANDROID_SUPPORT_VERSION"
    compile "com.android.support:support-v4:$ANDROID_SUPPORT_VERSION"
    

    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.

  • How to maintain fragment state without backstack in tab?
  • Error on using proguard with Android Facebook sdk 3.0
  • What does “This method is deprecated” mean for application developers
  • How to launch Android Calendar application using Intent (Froyo)
  • Android studio omits breakpoints
  • How to serialize a Bundle?
  • 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 https://developer.android.com/tools/support-library/index.html#revisions) so the dependencies section of your gradle file should look like this.

    compile "com.android.support:support-v4:23.1.1"
    compile "com.android.support:appcompat-v7:23.1.1"
    compile "com.android.support:support-annotations:23.1.1"
    

    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 ‘com.android.tools.build:gradle:2.2.3’

    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:

    import android.support.v7.app.AppCompatActivity;
    

    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.