1

I'm relying on the compatibility library to use action bars on older versions of Android. I've added it to my build.gradle file like this:

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.android.support:support-v4:+'
}

And an example of a styles.xml file:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Base theme -->
    <style name="AppName" parent="@style/Theme.AppCompat.Light"></style>
</resources>

The project builds successfully in Android Studio 0.4.4 both from the commandline and from the IDE. However, the following error appears when opening the file in the editor:

I've tried invalidating the cache, cleaning the project, syncing with Gradle and reimporting the project after deleting the IntelliJ files, but nothing changes. I also get errors like this in the build.gradle file:

But I don't know if that's related to this specific problem. How do I make Android Studio find the compatibility library resources?

Overv
  • 8,433
  • 2
  • 40
  • 70
  • It was an issue of 0.4.2, I am surprised to see such things in 0.4.4, Have a look at this question http://stackoverflow.com/questions/21316055/actionbaractivity-cannot-resolve-a-symbol/21316981#21316981 – Piyush Agarwal Feb 14 '14 at 03:58
  • @pyus13 Strangely Android Studio *can* find the classes, it's only the resources it can't find. – Overv Feb 14 '14 at 15:54

1 Answers1

2

It seems like a bug in Android Studio, I have reported the bug here

https://code.google.com/p/android/issues/detail?id=65979&thanks=65979&ts=1392399233

Follow this link for updates.

But one thing wondered me in your question is @style before Theme.AppCompat.Light @style is only used to refer your own styles.For appcompat styles I am directly using Theme.AppCompat.Light like

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
</style>

But error is showing as per your question in my case as well.

For build.gradle file :

As of now gradle file editor shows "Cannot find symbols" for all the things inside android tag. Not an issue.

Piyush Agarwal
  • 25,608
  • 8
  • 98
  • 111