Cannot resolve symbol Theme, ThemeOverlay

2019-01-24 01:11发布

I updated my android studio to latest version - 3.0.1. Since then it complains 'Cannot resolve symbol' for Theme and ThemeOverlay in the following lines of code. App runs fine but they are marked in RED in the file.

styles.xml

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"></style>
 <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

build.gradle is updated with the latest version

 dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }

3条回答
我只想做你的唯一
2楼-- · 2019-01-24 01:36

Found Easiest Way

  • Close project (File> Close Project)
  • Import / Re-Open project again (NOT from Recent)

The error should be gone.

If(that_did_not_work)

  • Open build.gradle, remove appcompact-v7 dependency and sync.
  • Again add that dependency and sync.

Error Gone!

查看更多
SAY GOODBYE
3楼-- · 2019-01-24 01:43

1)Close the project from the File menu.

2)Open the project again as existing Android Studio project.

enter image description here

This fix my problem.

查看更多
三岁会撩人
4楼-- · 2019-01-24 01:44
  1. In the app/build.gradle remove the line responsible for the appcompat package (something like implementation 'com.android.support:appcompat-v7:27.1.1')
  2. Perform the Gradle sync. It will break and show a lot of errors
  3. Bring the original line back
  4. Perform the Gradle sync once again

This will magically solve the problem that for no reason appeared in the 3.0.1

查看更多
登录 后发表回答