Cannot resolve symbol AppCompatActivity - Support v7 libraries aren't recognized?
Okay, I fixed it by rebuilding it for doing a ./gradlew clean assemble for the fourth time... Android Studio is a weird thing
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.
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.
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.
Cannot resolve AppCompatActivity after upgrade project from gradle 2.1 to 3.5
If you are going to update gradle
version specially 3.1+
than you might need to upgrade support lib
version too. its weird but it seems compatibility issues between gradle
version and support lib
version.
Trouble with AppcompatActivity - error: cannot find symbol class AppCompatActivity
I assume, that you forget to add the dependency to the appcompat support library. Add this to your build.gradle
in the app folder:
dependencies {
...
// Add this line
implementation 'artifact com.android.support:appcompat-v7:28.0.0-alpha1'
}
However, you should read other tutorials as well because you will proably face more issues, when you don't know how dependencies work in Android. If you create a fresh project in Android Studio, it will create a runnable app for you which is a good point to start off.
EDIT
I re-read your code and the import is incorrect. It must be
android.support.v7.app.AppCompatActivity
instead of
android.v7.app.AppCompatActivity
Android Studio: Play Services libraries (GCM & Maps) unresolved (errors) but project is working correctly
Apparently the version I had for GCM and maps was too low. I had to update to a higher version and the unresolved references disappeared. I'm using 11.8.0 right now.
Related Topics
How to Change Firebase Project Directory
Android: How to Send an Image as Email Attachment from Application
Jsonexception: Value of Type Java.Lang.String Cannot Be Converted to Jsonobject
Room Delete Query Does Not Remove the Row in Database
Apk Installation Failed: [Install_Failed_Verification_Failure]
Edittext Background Base Line Color Changing Based on Its Focus in Android
Background Drawable Not Applying to Button
Android Kotlin Call a Function in Other Activity
Passing an Arraylist of Objects to the New Activity
How to Open Local Pdf File in Webview in Android
Cannot Resolve Symbol Appcompatactivity - Support V7 Libraries Aren't Recognized
Concatenate Multiple Strings in Xml
How to Programmatically Change the Colour of a Textview, to a Colour Saved in an Attributes File
Access Ro.Serialno from Native in Android 8
Google Maps, No Option for Starting the Navigation, Only Preview Is There