Android Studio 3.1 Cannot Resolve Symbol (Themes, Widget, attr, etc.)

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:

  1. Open your app module's build.gradle file
  2. 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
    
  3. Sync your project with gradle. You will have some errors now. Don't worry about that.

  4. 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
    
  5. 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.

Close the project and import it again. Worked for me today.

import project