Appcompat库错误:找不到与给定名称匹配的资源

4

我正在为一款4.0.3的Android设备(API级别15)开发应用程序。我正在使用Appcompat支持库。 看起来这个库只适用于针对版本21的项目。 我的应用程序在这个版本上运行得很完美,但是当我将它转到API 15时,我遇到了大量“找不到与给定名称匹配的资源...”错误。

[2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:20: error: Error: No resource found that matches the given name: attr 'android:layout_marginStart'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:25: error: Error: No resource found that matches the given name: attr 'android:paddingEnd'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:24: error: Error: No resource found that matches the given name: attr 'android:paddingStart'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:29: error: Error: No resource found that matches the given name: attr 'android:layout_alignParentEnd'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:33: error: Error: No resource found that matches the given name: attr 'android:layout_alignParentStart'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:37: error: Error: No resource found that matches the given name: attr 'android:layout_toStartOf'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:42: error: Error: No resource found that matches the given name: attr 'android:layout_toEndOf'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:41: error: Error: No resource found that matches the given name: attr 'android:layout_toStartOf'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:47: error: Error: No resource found that matches the given name: attr 'android:paddingEnd'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:52: error: Error: No resource found that matches the given name: attr 'android:layout_marginEnd'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:51: error: Error: No resource found that matches the given name: attr 'android:paddingStart'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:57: error: Error: No resource found that matches the given name: attr 'android:paddingEnd'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:56: error: Error: No resource found that matches the given name: attr 'android:paddingStart'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:61: error: Error: No resource found that matches the given name: attr 'android:paddingEnd'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:65: error: Error: No resource found that matches the given name: attr 'android:layout_marginStart'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:69: error: Error: No resource found that matches the given name: attr 'android:layout_alignParentStart'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:70: error: Error: No resource found that matches the given name: attr 'android:textAlignment'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v11\themes_base.xml:338: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v14\themes_base.xml:29: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v11\themes_base.xml:345: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v14\themes_base.xml:37: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v11\themes_base.xml:352: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v14\themes_base.xml:45: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v11\themes_base.xml:359: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:41 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v14\themes_base.xml:53: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
    [2015-03-23 11:59:41 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:20: error: Error: No resource found that matches the given name: attr 'android:layout_marginStart'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:25: error: Error: No resource found that matches the given name: attr 'android:paddingEnd'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:24: error: Error: No resource found that matches the given name: attr 'android:paddingStart'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:29: error: Error: No resource found that matches the given name: attr 'android:layout_alignParentEnd'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:33: error: Error: No resource found that matches the given name: attr 'android:layout_alignParentStart'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:37: error: Error: No resource found that matches the given name: attr 'android:layout_toStartOf'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:42: error: Error: No resource found that matches the given name: attr 'android:layout_toEndOf'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:41: error: Error: No resource found that matches the given name: attr 'android:layout_toStartOf'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:47: error: Error: No resource found that matches the given name: attr 'android:paddingEnd'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:52: error: Error: No resource found that matches the given name: attr 'android:layout_marginEnd'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:51: error: Error: No resource found that matches the given name: attr 'android:paddingStart'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:57: error: Error: No resource found that matches the given name: attr 'android:paddingEnd'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:56: error: Error: No resource found that matches the given name: attr 'android:paddingStart'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:61: error: Error: No resource found that matches the given name: attr 'android:paddingEnd'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:65: error: Error: No resource found that matches the given name: attr 'android:layout_marginStart'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:69: error: Error: No resource found that matches the given name: attr 'android:layout_alignParentStart'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v17\styles_rtl.xml:70: error: Error: No resource found that matches the given name: attr 'android:textAlignment'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v11\themes_base.xml:338: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v14\themes_base.xml:29: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v11\themes_base.xml:345: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v14\themes_base.xml:37: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v11\themes_base.xml:352: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v14\themes_base.xml:45: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v11\themes_base.xml:359: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
    [2015-03-23 11:59:43 - MasterApplication] 
    [2015-03-23 11:59:43 - MasterApplication] C:\Users\sb\workspace\android-support-v7-appcompat\res\values-v14\themes_base.xml:53: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
    [2015-03-23 11:59:43 - MasterApplication]

1
“似乎这个库只适用于针对版本21的项目”——不是这样的,它仅适用于编译至Android SDK API 21(或更高版本)的项目。鉴于您使用的是Eclipse(考虑到您路径中的“workspace”引用),请转到Project > Properties > Android,并将“build target”设置为API Level 21或更高版本。 - CommonsWare
1个回答

8

您编译代码使用的SDK版本应该大于或等于支持库的版本。

例如,如果您指定了以下依赖项:

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

如果您使用的是AppCompat库,那么您必须将compileSdkVersion设置为21或更高版本。

更多详细信息请参见此处


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接