【发布时间】:2017-04-10 20:51:30
【问题描述】:
从今天开始,Android Studio 无法在 styles.xml 中找到 AppCompat 主题,但例如代码中的 AppCompatActivity 确实得到了识别。我的 Android Studio 版本是 2.2.2,Build #AI-145.3360264
我已经尝试升级到最新的构建工具,编译 sdk (25) 版本等,但没有解决问题。
目前我已经安装了以下内容(来自 sdk 管理器):
- android api:19 和 23
- sdk 平台工具:25.0.1
- sdk 工具:25.2.3
- 构建工具:23.0.2 和 25.0.1
- 支持存储库:40
- 谷歌存储库:39
还有一些其他的,这里不应该列出来。
应用程序的build.gradle:
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'
}
【问题讨论】:
-
项目是否编译或只有 IDE 抱怨?使缓存无效/重新启动。
-
Invalidate caches/restart 没有改变任何东西,只有 IDE 抱怨它并且编译工作正常。很抱歉可能会浪费您的时间,我只关心让错误消失,并认为编译仍然无法正常工作^^
-
我有同样的错误,但编译正常
-
stackoverflow.com/a/48734990/8311441 当所有其他解决方案都失败时这对我有帮助
-
刚刚遇到这个问题(在 Android Studio 3.1.3 中)。删除
appcompat-v7并在再次添加之前进行同步有帮助。让我们在这里投票并希望更新 issuetracker.google.com/issues/67790757
标签: android android-studio gradle android-appcompat android-styles