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
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
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.
~ Answered on 2015-06-07 21:26:46