I've just tried to use Android Studio. I've created blank project and tried to create Activity
which extends AppCompatActivity
. Unfortunalty Android Studio "says" that it
Cannot resolve symbol 'AppCompatActivity'
I have compile "com.android.support:appcompat-v7:22.0.+"
in dependency list of my "app" module and rebuilt project several times. However I can only use ActionBarActivity
. What am I doing wrong?
File -> Invalidate Caches -> Invalidate and Restart
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.