Cannot resolve symbol 'AppCompatActivity' Cannot resolve symbol 'AppCompatActivity' android android

Cannot resolve symbol 'AppCompatActivity'


A little addition to other answers here, for anyone having the same error while using the right lib version and the right class.

When I upgraded to

appcompat-v7:22.1.0

In which ActionBarActivity is deprecated and empty and AppCompatActivty is the way to go, due to some glitch in Android Studio, It didn't quite pick up on version change.

i.e. Even though Gradle ran without errors, the IDE itself kept saying Cannot resolve symbol 'AppCompatActivity' (and it also wasn't available through the Ctrl+N search)

I looked into the .idea/libraries folder and noticed there's no appropriate metafile for the new version of the lib.

So, using the old-reliable File->Invalidate Caches/Restart did the trick. Always try this when you feel something is magically wrong with Android Studio.And then Disable offline mode and sync.


If the soft methods via gradle file / "Invalidate caches" and the other IDE tools do not work, use the hard way:

  1. Exit Android Studio
  2. Navigate in your project to the .idea folder
  3. Just Rename the libraries folder
  4. Restart Android Studio. It should now recreate the libraries folder and work again.

This worked for me on

Android Studio 3.1.2Build #AI-173.4720617, built on April 13, 2018JRE: 1.8.0_152-release-1024-b01 amd64JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.oLinux 4.13.0-38-generic

Shahbaz Ali confirmed, it works also on

Android Studio 3.1.3Build #AI-173.4819257, built on June 4, 2018JRE: 1.8.0_152-release-1024-b01 amd64JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.oLinux 4.13.0-38-generic

moujib confirmed, it works on Android Studio 3.2.1


Today (22 April) you can use the new AppCompatActivity released with the support libraries v 22.1.0.

Just change your dependency :

compile "com.android.support:appcompat-v7:22.1.0"

Here you can find more info about this new class.