我正在为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]
答案 0 :(得分:8)
您编写代码的SDK版本应为> =支持库的版本。
例如,如果您指定此依赖项:
dependencies {
compile 'com.android.support:appcompat-v7:21.0.+'
}
然后您还必须使用compileSdkVersion 21
(或更高版本)。
更多详情here。