android – 切换到ActionBarCompat,但有与主题相关的构建错误

前端之家收集整理的这篇文章主要介绍了android – 切换到ActionBarCompat,但有与主题相关的构建错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试将ActionBarCompat集成到我的一个项目中.我使用Gradle构建系统.

我已将依赖项添加为:

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

我没有使用自定义样式,我在AndroidManifest.xml中设置了主题

<application
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:theme="@style/Theme.AppCompat" >

问题是这是在Android库项目中. ActionBarSherlock工作得很好.但现在我得到以下错误.

LibraryProject/build/res/all/release/values/values.xml:764: error: Error: No resource found that matches the given name: attr 'dropdownListPreferredItemHeight'.
LibraryProject/build/res/all/release/values/values.xml:768: error: Error: No resource found that matches the given name: attr 'popupMenuStyle'.
LibraryProject/build/res/all/release/values/values.xml:813: error: Error: No resource found that matches the given name: attr 'dropdownListPreferredItemHeight'.
LibraryProject/build/res/all/release/values/values.xml:817: error: Error: No resource found that matches the given name: attr 'popupMenuStyle'.
LibraryProject/build/res/all/release/values/values.xml:848: error: Error: No resource found that matches the given name: attr 'dropdownListPreferredItemHeight'.
LibraryProject/build/res/all/release/values/values.xml:852: error: Error: No resource found that matches the given name: attr 'popupMenuStyle'.
LibraryProject/build/res/all/release/values/values.xml:912: error: Error: No resource found that matches the given name: attr 'actionDropDownStyle'.
LibraryProject/build/res/all/release/values/values.xml:925: error: Error: No resource found that matches the given name: attr 'listChoiceBackgroundIndicator'.
LibraryProject/build/res/all/release/values/values.xml:923: error: Error: No resource found that matches the given name: attr 'panelMenuListTheme'.
LibraryProject/build/res/all/release/values/values.xml:922: error: Error: No resource found that matches the given name: attr 'panelMenuListWidth'.
LibraryProject/build/res/all/release/values/values.xml:969: error: Error: No resource found that matches the given name: attr 'actionDropDownStyle'.
LibraryProject/build/res/all/release/values/values.xml:975: error: Error: No resource found that matches the given name: attr 'listChoiceBackgroundIndicator'.
LibraryProject/build/res/all/release/values/values.xml:973: error: Error: No resource found that matches the given name: attr 'panelMenuListTheme'.
LibraryProject/build/res/all/release/values/values.xml:972: error: Error: No resource found that matches the given name: attr 'panelMenuListWidth'.
LibraryProject/build/res/all/release/values/values.xml:998: error: Error: No resource found that matches the given name: attr 'actionDropDownStyle'.
LibraryProject/build/res/all/release/values/values.xml:1002: error: Error: No resource found that matches the given name: attr 'listChoiceBackgroundIndicator'.

可能是什么问题?有人可以提出解决方案吗?

@H_403_17@解决方法
我终于找到了问题!看起来我的attrs.xml文件中有一个冗余声明:
<declare-styleable name="Theme">
    </declare-styleable>

我不知道为什么我会在那里宣布这一点.可能是一些复制粘贴代码.但那是问题的根源.

我现在ActionBarCompat工作得很好.顺便说一句,ActionBarSherlock与上述声明完美配合.

猜你在找的Android相关文章