Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why won't Android Studio find my resources?

Android Studio code inspection seems to not find any of the project-specific resources.

For example my styles.xml

<resources>   <style name="AppBaseTheme" parent="Holo.Theme.Light.DarkActionBar">   </style>    <!-- Application theme. -->   <style name="AppTheme" parent="AppBaseTheme">   </style> </resources> 

Marks the second AppBaseTheme red and says: "Cannot resolve symbol 'AppBaseTheme'".

The app compiles and runs without problems but I don't have any code-completion on resources. The inspection seems to find the ActionBarSherlock resources and HoloEverywhere resources (e.g. Holo.Theme.Light.DarkActionBar, auto-complete works too) though.

build.gradle of the app (sub)project

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']         }     } } 
like image 486
lukrop Avatar asked May 31 '13 13:05

lukrop


People also ask

Where is pick a resource Android studio?

For a normal device, the resources from /drawable/ folder will be picked. However, for a device with high-density screen, the resources will be picked from the /drawable-hdpi/ folder, if one exists.

How do I manage resources in Android?

Resource Manager is a tool window for importing, creating, managing, and using resources in your app. You can open the tool window by selecting View > Tool Windows > Resource Manager from the menu bar or by selecting Resource Manager on the left side bar. Click Add to add a new resource to your project.


1 Answers

The first thing I would try is File > Invalidate Caches\Restart > Invalidate and Restart.

This has fixed all resource issues I've ever had with Android Studio.

like image 71
bcorso Avatar answered Oct 05 '22 23:10

bcorso