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