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

前端 未结 16 2035
梦如初夏
梦如初夏 2020-11-29 01:21

I upgraded Android Studio today to 3.1, and now Android Studio says it cannot resolve symbols for most of the resources (for example ThemeOverlay in style

16条回答
  •  执念已碎
    2020-11-29 02:04

    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.

提交回复
热议问题