5

I have imported appcompat library through:

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.android.support:appcompat-v7:+'
  compile 'com.android.support:support-v4:+'
}

in my {ProjectName}/{ModuleName}/build.gradle. The library shows up in external libraries. Yet, I can't build the app because when I try, there's an error in my styles.xml:

Error:Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'

This is where I declare a theme to derive from AppCompat theme, like this:

  <style name="TextStyleSuperClass" parent="@style/Theme.AppCompat.Light">
  </style>

Do you know how to fix this?

  • http://stackoverflow.com/questions/17870881/cant-find-theme-appcompat-light-for-new-android-actionbar-support – Ronny K Jun 15 '14 at 18:36
  • Thanks for taking interest, but the accepted answer in this link is for Eclipse IDE. The Android Studio + Gradle combination should just import the library with the resources. But somehow, it doesn't see the resources :/. I'm doing it like it says in the doc: https://developer.android.com/tools/support-library/setup.html#libs-with-res – Bigos Trismegistos Jun 15 '14 at 18:48

2 Answers2

1

On this site "Getting ActionBar support library working with Android Studio" I'v found the following line and added it to the activity in the AndroidManifest.xml:

android:theme="@style/Theme.AppCompat.Light"

From that on Android Studio was able to resolve Theme.AppCompat

Dirk
  • 2,011
  • 1
  • 20
  • 25
0

You need to skip the @style entirely. Use:

android:theme="ThemeOverlay.AppCompat.Dark.ActionBar"

This works with version 25 of the SDK

stef
  • 161
  • 1
  • 10