AppCompat V7 R21返回错误values​​.xml?错误、AppCompat、xml、values

由网友(没钱充会员)分享简介:我使用Android的工作室,当我加入编译com.android.support:appcompat-v7:21.0.0来我的摇篮文件,我得到一吨的错误:C:\Users\WindowsSucks\AndroidStudioProjects\MMMeds\app\build\intermediates\explode...

我使用Android的工作室,当我加入编译com.android.support:appcompat-v7:21.0.0 来我的摇篮文件,我得到一吨的错误:

C:UsersWindowsSucksAndroidStudioProjectsMMMedsappbuildintermediatesexploded-aarcom.android.supportappcompat-v721.0.0resvalues-v11values.xml 错误:(36 21)否资源发现,匹配给定的名字:ATTR机器人:actionModeShareDrawable。 错误:(36 21)否资源发现,匹配给定的名字:ATTR机器人:actionModeShareDrawable。 错误:(36 21)否资源发现,匹配给定的名字:ATTR机器人:actionModeShareDrawable。 错误:(36 21)否资源发现,匹配给定的名字:ATTR机器人:actionModeShareDrawable。 C:UsersWindowsSucksAndroidStudioProjectsMMMedsappbuildintermediatesexploded-aarcom.android.supportappcompat-v721.0.0resvalues-v14values.xml 错误:(9,21)没有发现资源匹配给定名称:ATTR机器人:actionModeShareDrawable。 错误:(9,21)没有发现资源匹配给定名称:ATTR机器人:actionModeShareDrawable。 错误:(9,21)没有发现资源匹配给定名称:ATTR机器人:actionModeShareDrawable。 错误:(9,21)没有发现资源匹配给定名称:ATTR机器人:actionModeShareDrawable。 C:UsersWindowsSucksAndroidStudioProjectsMMMedsappbuildintermediatesexploded-aarcom.android.supportappcompat-v721.0.0resvalues-v21values.xml 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Body1。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Body2。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Button。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Caption。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Display1。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Display2。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Display3。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Display4。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Headline。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Inverse。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Large。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Large.Inverse。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Widget.PopupMenu.Large。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Widget.PopupMenu.Small。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Medium。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Medium.Inverse。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Menu。 错误:错误检索父项:未发现的资源匹配给定名称@android:TextAppearance.Material.SearchResult.Subtitle。 错误:错误检索父项:未发现的资源匹配给定名称@android:TextAppearance.Material.SearchResult.Title。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Small。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Small.Inverse。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Subhead。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Title。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Widget.ActionBar.Menu。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Widget.ActionBar.Subtitle。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Widget.ActionBar.Title。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Widget.ActionBar.Title.Inverse。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Widget.ActionMode.Subtitle。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Widget.ActionMode.Title。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Widget.PopupMenu.Large。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Widget.PopupMenu.Small。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Button。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Widget.ActionBar.Subtitle。 错误:错误检索父项:未发现的资源匹配给定名称机器人:TextAppearance.Material.Widget.ActionBar.Title。 错误:错误检索父项:未发现的资源匹配给定名称机器人:ThemeOverlay.Material。 错误:错误检索父项:未发现的资源匹配给定名称机器人:ThemeOverlay.Material.ActionBar。 错误:错误检索父项:未发现的资源匹配给定名称机器人:ThemeOverlay.Material.Dark。 错误:错误检索父项:未发现的资源匹配给定名称机器人:ThemeOverlay.Material.Dark.ActionBar。 错误:错误检索父项:未发现的资源匹配给定名称机器人:ThemeOverlay.Material.Light。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.ActionBar.TabText。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.ActionBar.TabView。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.ActionButton。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.ActionButton.CloseMode。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.ActionButton.Overflow。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.AutoCompleteTextView。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.DropDownItem.Spinner。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.Light.ActionBar.TabText。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.Light.ActionBar.TabText。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.Light.ActionBar.TabView。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.AutoCompleteTextView。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.Light.PopupMenu。 错误:(298,21)否资源发现,匹配给定的名字:ATTR机器人:overlapAnchor。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.ListPopupWindow。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.ListView.DropDown。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.ListView。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.PopupMenu。 错误:(298,21)否资源发现,匹配给定的名字:ATTR机器人:overlapAnchor。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.ProgressBar。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.ProgressBar.Horizo​​ntal。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.Spinner。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.Spinner。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Widget.Material.Toolbar.Button.Navigation。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Theme.Material。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Theme.Material.Dialog。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Theme.Material.Light。 错误:错误检索父项:未发现的资源匹配给定名称机器人:Theme.Material.Light.Dialog。 错误:(144,21)否资源发现,匹配给定的名字:ATTR机器人:colorAccent。 错误:(146,21)否资源发现,匹配给定的名字:ATTR机器人:colorControlActivated。 错误:(147,21)否资源发现,匹配给定的名字:ATTR机器人:colorControlHighlight。 错误:(145,21)否资源发现,匹配给定的名字:ATTR机器人:colorControlNormal。 错误:(142,21)否资源发现,匹配给定的名字:ATTR机器人:colorPrimary。 错误:(143,21)否资源发现,匹配给定的名字:ATTR机器人:colorPrimaryDark。 错误:(144,21)否资源发现,匹配给定的名字:ATTR机器人:colorAccent。 错误:(146,21)否资源发现,匹配给定的名字:ATTR机器人:colorControlActivated。 错误:(147,21)否资源发现,匹配给定的名字:ATTR机器人:colorControlHighlight。 错误:(145,21)否资源发现,匹配给定的名字:ATTR机器人:colorControlNormal。 错误:(142,21)否资源发现,匹配给定的名字:ATTR机器人:colorPrimary。 错误:(143,21)否资源发现,匹配给定的名字:ATTR机器人:colorPrimaryDark。 错误:(144,21)否资源发现,匹配给定的名字:ATTR机器人:colorAccent。 错误:(146,21)否资源发现,匹配给定的名字:ATTR机器人:colorControlActivated。 错误:(147,21)否资源发现,匹配给定的名字:ATTR机器人:colorControlHighlight。 错误:(145,21)否资源发现,匹配给定的名字:ATTR机器人:colorControlNormal。 错误:(142,21)否资源发现,匹配给定的名字:ATTR机器人:colorPrimary。 错误:(143,21)否资源发现,匹配给定的名字:ATTR机器人:colorPrimaryDark。 错误:(144,21)否资源发现,匹配给定的名字:ATTR机器人:colorAccent。 错误:(146,21)否资源发现,匹配给定的名字:ATTR机器人:colorControlActivated。 错误:(147,21)否资源发现,匹配给定的名字:ATTR机器人:colorControlHighlight。 错误:(145,21)否资源发现,匹配给定的名字:ATTR机器人:colorControlNormal。 错误:(142,21)否资源发现,匹配给定的名字:ATTR机器人:colorPrimary。 错误:(143,21)否资源发现,匹配给定的名字:ATTR机器人:colorPrimaryDark。

所有这些似乎都显示在了:

appbuildintermediatesexploded-aarcom.android.supportappcompat-v721.0.0resvalues-v11values.xml

appbuildintermediatesexploded-aarcom.android.supportappcompat-v721.0.0resvalues-v21values.xml

解决方案

AppCompat V21建立需要在21 API提供的新API(安卓5.0)的主题。编译与AppCompat您的应用程序,你还必须对编译21 API编制推荐的设置/建筑与API 21是 compileSdkVersion 21 buildToolsVersion 21.0.1 (这是最高的,在这个时候 - 你总是要使用最新版本的工具)。

I'm using Android Studio and when I add compile "com.android.support:appcompat-v7:21.0.0" to my Gradle file, I'm getting a ton of errors:

C:UsersWindowsSucksAndroidStudioProjectsMMMedsappbuildintermediatesexploded-aarcom.android.supportappcompat-v721.0.0resvalues-v11values.xml
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
C:UsersWindowsSucksAndroidStudioProjectsMMMedsappbuildintermediatesexploded-aarcom.android.supportappcompat-v721.0.0resvalues-v14values.xml
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
C:UsersWindowsSucksAndroidStudioProjectsMMMedsappbuildintermediatesexploded-aarcom.android.supportappcompat-v721.0.0resvalues-v21values.xml
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'.
Error:Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Menu'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.ActionBar'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Dark'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Dark.ActionBar'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Light'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabText'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.Overflow'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.DropDownItem.Spinner'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.PopupMenu'.
Error:(298, 21) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListPopupWindow'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView.DropDown'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.PopupMenu'.
Error:(298, 21) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Toolbar.Button.Navigation'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Dialog'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.Dialog'.
Error:(144, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(146, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(147, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(145, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(142, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(143, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(144, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(146, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(147, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(145, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(142, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(143, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(144, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(146, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(147, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(145, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(142, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(143, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(144, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(146, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(147, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(145, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(142, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(143, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.

All of these seem to be showing up in:

appbuildintermediatesexploded-aarcom.android.supportappcompat-v721.0.0resvalues-v11values.xml

and

appbuildintermediatesexploded-aarcom.android.supportappcompat-v721.0.0resvalues-v21values.xml

解决方案

AppCompat v21 builds themes that require the new APIs provided in API 21 (Android 5.0). To compile your application with AppCompat, you must also compile against API 21. The recommended setup for compiling/building with API 21 is a compileSdkVersion of 21 and a buildToolsVersion of 21.0.1 (which is the highest at this time - you always want to use the latest build tools).