Android Studio 3.1 Cannot Resolve Symbol (Themes, Widget, attr, etc.)
Solution 1:
Close the project and import it again. Worked for me today.
Solution 2:
Close and reopen project as existing Android Studio project
Solution 3:
The support library is out of sync.
This error happens because the support library gets out of sync with your project. To get it back in sync you can do the following steps:
- Open your app module's build.gradle file
-
Comment out the
implementation
lines for the support library. For me it looks like this://implementation 'com.android.support:appcompat-v7:27.1.1' //implementation 'com.android.support:recyclerview-v7:27.1.1' //implementation 'com.android.support.constraint:constraint-la
Sync your project with gradle. You will have some errors now. Don't worry about that.
-
Uncomment the
implementation
lines that you previously commented out.implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:recyclerview-v7:27.1.1' implementation 'com.android.support.constraint:constraint-la
Sync your project with gradle again.
The "Cannot Resolve Symbol" error should be gone now. This has worked for me several times on different projects.
Note
- If your project has multiple modules, then you need to follow the directions above for all of the modules at once.
Solution 4:
After upgrading Android Studio, you can invalidate cache and restart.
File
> Invalidate Caches / Restart…