简体   繁体   中英

Android Studio: Theme.Sherlock.Light.DarkActionBar cannot be resolved

I have included the ABS aar, as seen here ( https://github.com/JakeWharton/ActionBarSherlock-Gradle-Sample ), in my project. It works fine with my classes, in my style XML, however, I get "Theme.Sherlock.Light.DarkActionBar cannot be resolved". My gradle file looks like this:

dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile 'com.android.support:support-v4:18.0.+'
}

In my style XML:

 <style name="AppTheme" parent="Theme.Sherlock.Light.DarkActionBar">
    <item name="textAppearanceFinish">@style/TextAppearanceFinish</item>
 </style>

What am I doing wrong?

Why you are using Theme.Sherlock.Light.DarkActionBar. You can implement this by android support library appcompact v7 that is stable and does not create any problem easy to use. you can do this by changing your code like

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="textAppearanceFinish">@style/TextAppearanceFinish</item>
 </style>

and in your gradle dependency

dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
compile 'com.android.support:appcompat-v7:22.0.0'

}

First of I presume that the ABS classes are rightly resolved in your IDE (ie they are not marked in red), since you don't mention it.

If you are using Android Studio < 0.4.3, there is a known bug (fixed in 0.4.3) where dependencies in the build scripts are not fully resolved. You can check if Your_Project/your_module/build/exploded-bundles/ComActionbarsherlock.../classes.jar exists. If not then the fix is in a few steps in this stackoverflow thread .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM