After renaming application package name, Android Studio displayed this error can't resolve symbol AppCompatActivity
Things I tried:
- Clean project
- Clean Android Studio cache
- Clean Gradle cache
- Re-installed IDE
- File-> Invalidate cache/restart
But nothing really helped. The project build successfully, but I can not use syntax highlighting.
I used com.android.support:appcompat-v7:23.1.1
Screenshots
I had the same issue and the following worked for me
There is some kind of caching issue that is happening. If such kind of issue appears try this since most of the time it will work :D
With the new Release of android studio 3.1.3, you must put this code inside build.gradle.
I've updated
appcompat
library from version25.0.1
to25.1.0
In gradle:
Everything works well now.
For me was enough to go on: - Tools > ANDROID > SYNC PROJECT WITH GRADLE FILES
Lets get going step by step: first clean project by using
if this doesn't helps then use your second weapon
But the real problem begins when all the above options doesn't works so use your ultimate weapon close project and go to project location directory and delete
You can open your project now again. This worked for me and problem comes most often when you are working with VCS. And this problem is not associated with android component classes but also to the libraries, both shows the same error.
If all attempts failed (invalidate cache, clean and rebuild, restart,...), close Android Studio (maybe just close the project), run any file manager, go to project folder, find .idea/libraries folder and delete its content (list of xml files). After new start AS or opening project the problem should be resolved.