无法在styles.xml (Android Studio) 中解析符号“主题" [英] Cannot resolve symbol 'Theme' in styles.xml (Android Studio)
问题描述
从今天开始,Android Studio 无法在styles.xml 中找到AppCompat 主题,但例如代码中的AppCompatActivity 确实得到了识别.我的 Android Studio 版本是 2.2.2,Build #AI-145.3360264
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 is 2.2.2, Build #AI-145.3360264
我已经尝试升级到最新的构建工具、编译 sdk (25) 版本等,但没有解决问题.
I already tried upgrading to the latest build tools, compile sdk (25) version etc. but it didn't fix the problem.
目前我已经安装了以下内容(来自 sdk 管理器):
At the moment I have installed the following (from sdk manager):
- android api:19 和 23
- sdk 平台工具:25.0.1
- sdk 工具:25.2.3
- 构建工具:23.0.2 和 25.0.1
- 支持存储库:40
- 谷歌存储库:39
以及其他一些,不必在此处列出.
and a few others, that shouldn't be necessary to list here.
应用的build.gradle:
build.gradle of app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.1'
defaultConfig {
applicationId "xxx.xxxxxxxx.xxxxxxxxx" //not the real applicationId
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/RootTools.jar')
compile 'com.android.support:support-v4:23.+'
compile 'com.android.support:support-v13:23.+'
compile 'com.android.support:appcompat-v7:23.+'
compile 'com.android.support:design:23.+'
compile 'com.android.support:cardview-v7:23.+'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'de.hdodenhof:circleimageview:2.1.0'
}
推荐答案
另一个适用于 Android Studio 3.1.2 的解决方案:
Another solution that worked for me with Android Studio 3.1.2:
如果有的话,从 build.gradle
中删除它们:
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.
这篇关于无法在styles.xml (Android Studio) 中解析符号“主题"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!