Android AppCompat v7 r21 在 values.xml 中返回错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26457096/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
AppCompat v7 r21 returning error in values.xml?
提问by Michael Garber
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:
我正在使用 Android Studio,当我添加compile "com.android.support:appcompat-v7:21.0.0"
到 Gradle 文件时,出现了大量错误:
C:\Users\WindowsSucks\AndroidStudioProjects\MMMeds\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7.0.0\res\values-v11\values.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:\Users\WindowsSucks\AndroidStudioProjects\MMMeds\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7.0.0\res\values-v14\values.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:\Users\WindowsSucks\AndroidStudioProjects\MMMeds\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7.0.0\res\values-v21\values.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:
所有这些似乎都出现在:
\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7.0.0\res\values-v11\values.xml
and
和
\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7.0.0\res\values-v21\values.xml
回答by ianhanniballake
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).
AppCompat v21 构建的主题需要 API 21 (Android 5.0) 中提供的新 API。要使用 AppCompat 编译您的应用程序,您还必须针对 API 21 进行编译。使用 API 21 编译/构建的推荐设置是 a compileSdkVersion
of21
和 a buildToolsVersion
of 21.0.1
(这是目前最高的 - 您总是希望使用最新的构建工具) .
回答by GiriB
Make sure the value for target(which tells the target android version) in project.propertiesfile of bothyour project folder and appcompat_v7folder is same (preferably the latest).
确保为价值目标中(它告诉目标Android版本)project.properties文件都项目文件夹和appcompat_v7文件夹是相同的(最好是最新的)。
: inside 'your_project'/project.properties
:在'your_project'/project.properties里面
target=android-21android.library.reference.1=../appcompat_v7
target=android-21android.library.reference.1=../appcompat_v7
and
和
: inside appcompat_v7/project.properties
: 在 appcompat_v7/project.properties 里面
target=android-21android.library=true
target=android-21android.library=true
and after this don't forget to cleanyour project .
在此之后不要忘记清理您的项目。
回答by shider
Changing compile 'com.android.support:appcompat-v7:21.0.0'
into compile 'com.android.support:appcompat-v7:20.0.0'
in gradle.build works for me.
更改compile 'com.android.support:appcompat-v7:21.0.0'
为compile 'com.android.support:appcompat-v7:20.0.0'
gradle.build 对我有用。
回答by Shabbir Ahmad
If you are using android studio goto File --> Project Structure In the Propertiestab change Compile Sdk Version to AP1 21and Build Tools Version to highest available version. And then Refresh Gradle
如果您使用的是 android studio goto File --> Project Structure 在属性选项卡中,将编译 Sdk 版本更改为 AP1 21,将构建工具版本更改为最高可用版本。然后刷新 Gradle
回答by megaKertz
changing the complie SDk version to API level 21 fixed it for me. then i ran into others issues of deploying the app to my device. i changed the minimun API level to target to what i want and that fixed it.
将 complie SDk 版本更改为 API 级别 21 为我修复了它。然后我遇到了将应用程序部署到我的设备的其他问题。我更改了最小 API 级别以针对我想要的目标并修复它。
incase someone is experiencing this again.
以防有人再次遇到这种情况。
回答by Hiren Patel
Just select target api level to 21for compiling, click Apply-> click OK, cleanand buildproject and runit.
只需选择目标 api 级别为21进行编译,单击Apply-> 单击OK,清理并构建项目并运行它。
回答by David Hackro
my solucion is compile with other version
我的解决方案是用其他版本编译的
build.gradle (app)
build.gradle(应用程序)
compileSdkVersion 21
Good Luck
祝你好运
回答by faro_hf
Change your compile sdkto 23.This fixed it for me.
将您的编译 sdk更改为23。这为我修复了它。
回答by Dexter
I vote whoever can solve like me. I had this same problem as u , I spent many hours to get correct . Please test .
我投票给像我一样能解决的人。我和你有同样的问题,我花了很多时间来纠正。请测试。
Upgrade entire SDK , the update 21.0.2 build also has updates from Google Services play . Upgrade everything. In your workspace delete folders ( android -support- v7 - AppCompat ) and ( google -play - services_lib )
升级整个 SDK,更新 21.0.2 版本也有来自 Google Services play 的更新。升级一切。在您的工作区中删除文件夹 ( android -support- v7 - AppCompat ) 和 ( google -play - services_lib )
Re-import these projects into the IDE and select to copy them to your workspace again.
将这些项目重新导入 IDE 并选择再次将它们复制到您的工作区。
The project ( google -play - services_lib ) to perform the action of Refresh and Build
执行 Refresh 和 Build 动作的项目 ( google -play - services_lib )
**** ***** Problem The project ( android -support- v7 - AppCompat ) mark the 5.0 API then Refresh and Build .
**** ***** 问题项目 (android -support- v7 - AppCompat) 标记 5.0 API,然后 Refresh 和 Build。
In his project , in properties , android , import libraries ( android -support- v7 - AppCompat ) and ( google -play - services_lib ) then Refresh and Build .
在他的项目中,在属性中,android,导入库(android-support-v7-AppCompat)和(google-play-services_lib)然后刷新和构建。
回答by DjP
If you don't want to use API 21 you can use the older version of appcompact library, use older app compact library without updating it.
如果您不想使用 API 21,您可以使用旧版本的 appcompact 库,使用旧版应用程序紧凑库而不更新它。
you can achieve this by simply following steps:
您只需通过以下步骤即可实现此目的:
1) Extract the downloaded version of complete sdk and eclipse bundle.
1) 解压下载的完整sdk 和eclipse 包。
2) Simply import appCompact library from sdk\extras\android\support\v7\appcompact
2) 只需从中导入 appCompact 库 sdk\extras\android\support\v7\appcompact
now you are done.
现在你完成了。