After renaming application package name, Android Studio displayed this error can\'t resolve symbol AppCompatActivity
Things I tried: <
In Android Studio 3.1.2, I have the same issue After renaming application package name. The following worked for me:
Deleting the ".idea" folder, Then File -> Invalidate Caches/Restart
.
I've updated appcompat
library from version 25.0.1
to 25.1.0
In gradle:
from: com.android.support:appcompat-v7:25.0.1
to: com.android.support:appcompat-v7:25.1.0
Everything works well now.
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.
head over to build.gradle(module app)
if you hover your mouse over to com.android.support:appcompat a popup will say new version is available just replace in the existing version number with the new version number press sync now and you are good to go p.s nothing else worked for me on 2 pc's
For me was enough to go on: - Tools > ANDROID > SYNC PROJECT WITH GRADLE FILES
I've noticed that Android Studio 3.1 doesn't pull in the support libraries seamlessly. Here's how to trigger it. Update the support library version to 27.x.x
newer version (you can get the new version info by mouse hover over the version number next to implementation under dependencies ) manually in the module's build.gradle
file under dependencies. Then re-sync the project. Find the Visual Solution(Image) from this Link