Android Studio代码检查似乎找不到任何项目特定的资源。为什么Android Studio不能找到我的资源?
比如我styles.xml
<resources>
<style name="AppBaseTheme" parent="Holo.Theme.Light.DarkActionBar">
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
</style>
</resources>
标志着第二AppBaseTheme红,说: “不能解析符号 'AppBaseTheme'”。
该应用程序编译和运行没有问题,但我没有任何代码完成资源。虽然检查似乎找到了ActionBarSherlock资源和HoloEverywhere资源(例如Holo.Theme.Light.DarkActionBar,自动完成作品)。
的应用程序(子)项目的build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.1'
}
}
apply plugin: 'android'
dependencies {
//compile files('libs/android-support-v4.jar')
compile project(':abs-library')
compile project(':he-library')
compile project(':he-addons:slider')
compile project(':he-addons:preferences')
// using a custom repo here
compile 'com.google.android:support-v4:r13'
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 17
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java']
// abs-res, he-res are symlinks to ../abs-library/res
// and ../he-library/res
res.srcDirs = ['src/main/res', 'abs-res', 'he-res']
}
}
}
截图:http://lukas.kropatschek.net/as-inspection-error.png
已经尝试过,结果是一样的。另请参阅截图,在AndroidManifest.xml中也有类似的错误,例如它找不到@ drawable/ic_launcher。它编译和运行,所以我认为代码是正确的,它只是Android Studio的代码检查,不知道我认为的那些资源。 – lukrop
您是否尝试清理该项目? –
清理完毕后,在重建过程中,一切似乎都没问题,只要(gradle)后台任务完成,检查再次启动并投诉。 – lukrop