Cannot resolve symbol 'Theme' in styles.xml (Android Studio)

后端 未结 23 2100
半阙折子戏
半阙折子戏 2020-11-27 11:56

Since today, Android Studio can\'t find the AppCompat themes in styles.xml, but for example AppCompatActivity in code does get recognized. My Android Studio version

相关标签:
23条回答
  • 2020-11-27 12:31

    I switched support lib to version 27.1.1 and problem has been solved. Seems like some bug in 27.1.0

    0 讨论(0)
  • 2020-11-27 12:31

    This is weird, I encounter this problem as below:

    • Android Studio is 3.1.2
    • support lib version is 27.0.0

    I solve this by below:

    1. change support lib version to 27.1.0, and "Sync Project with Gradle Files", then this error disappear
    2. change support lib version to 27.0.0,and "Sync Project with Gradle Files", then this error not appear again
    0 讨论(0)
  • 2020-11-27 12:32

    I encountered same problem like this.Just the difference is I was using Studio 2.2.3. This is what solved my problem:

    In my project level gradle I had:

    classpath 'com.android.tools.build:gradle:2.3.0-alpha2' (which was a result of updating studio)

    which I replaced with: classpath 'com.android.tools.build:gradle:2.2.3'

    I think you should look for a compatible classpath for your gradle configuration.

    0 讨论(0)
  • 2020-11-27 12:35

    Another solution that worked for me with Android Studio 3.1.2:

    delete these from build.gradle if you have them:

    'com.android.support:appcompat-v7:27.1.1' 'com.android.support:design:27.1.1'

    then sync, then undo delete, then sync again.

    0 讨论(0)
  • 2020-11-27 12:37

    I was having the same issue after linking Firebase to my app. Updating the build.gradle in the app module did the trick, updated to:

    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.firebase:firebase-database:11.8.0'
    
    0 讨论(0)
  • 2020-11-27 12:37

    In newer versions of Android Studio, we are asked to use 'AppCompat'. Some users uncheck that and still use the Theme.AppCompat. That makes up this error. Same happened with me.

    Solution is to add this line in your build.gradle (app).

    compile 'com.android.support:appcompat-v7:26.1.0'
    
    0 讨论(0)
提交回复
热议问题