检索项目的父项时出错:找不到与给定名称“Theme.AppCompat.Light”匹配的资源。我的 R.java 不见了
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26718480/
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
Error retrieving parent for item:No resource found that matches the given name 'Theme.AppCompat.Light'. MY R.java is missing
提问by JumboJey
Google has now Android Lollipop, I opened my sdk manager and decided to update couple of packages... It is furstrating me from 2 days. Can't find theme
谷歌现在有 Android Lollipop,我打开了我的 sdk 管理器并决定更新几个包......这让我感到沮丧 2 天。 找不到主题
I have also tried this: Failed to rename directory
我也试过这个:无法重命名目录
Unsuccessful. I tried to download a new sdk from Google and install from scratch, did not work again. Here is the error.
不成功。我试图从 Google 下载一个新的 sdk 并从头开始安装,但再次不起作用。这是错误。
D:\~\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
D:\~\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
D:\~\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
[1]: https://stackoverflow.com/questions/8839255/failed-to-rename-directory-tools-to-temp-toolpackage-old01-in-c-android-sdk-win
I will be very thankful if someone help me try running my eclipse Juno. I can also say that some of my old apps are working with lower version, but when I create a new one... error:
如果有人帮助我尝试运行我的 eclipse Juno,我将非常感激。我也可以说我的一些旧应用程序正在使用较低版本,但是当我创建一个新应用程序时......错误:
import android.support.v7.app.ActionBarActivity;
It is not reading the android.suppor.v7
import android.support.v7.app.ActionBarActivity;
它不是在阅读 android.suppor.v7
then if I reference it to my android app I have a ! sign and lots of mistakes like:
然后,如果我将它引用到我的 android 应用程序中,我就有了一个 ! 签名和很多错误,如:
D:\Android Studio\adt-bundle-windows-x86_64-20140702\sdk\extras\android\support\v7\appcompat\res\values-v21\themes_base.xml:193: error: Error: No resource found that matches the given name: attr 'android:colorControlNormal'.
D:\Android Studio\adt-bundle-windows-x86_64-20140702\sdk\extras\android\support\v7\appcompat\res\values-v21\themes_base.xml:190: error: Error: No resource found that matches the given name: attr 'android:colorPrimary'.
D:\Android Studio\adt-bundle-windows-x86_64-20140702\sdk\extras\android\support\v7\appcompat\res\values-v21\themes_base.xml:191: error: Error: No resource found that matches the given name: attr 'android:colorPrimaryDark'.
采纳答案by Grzegorz Sulich
For me with the latest (21.0.2) version of Android Support Library the solution was to change the build target for appcompat_v7 project to API 21 (Android 5.0), clean and rebuild.
对于我使用最新 (21.0.2) 版本的 Android 支持库,解决方案是将 appcompat_v7 项目的构建目标更改为 API 21 (Android 5.0),清理并重建。
回答by esoxjem
Did you try updating the target SDK to 21 and building the project?
您是否尝试将目标 SDK 更新为 21 并构建项目?
回答by russellhoff
Got the same problem... Perhaps one solution is to download an old sdk and not updating it.
遇到了同样的问题...也许一种解决方案是下载旧的 sdk 而不是更新它。
回答by DDOc
I solved the problem changing in gradle
我解决了在 gradle 中改变的问题
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:support-v4:21.0.0'
to
到
compile 'com.android.support:appcompat-v7:19.0.0'
compile 'com.android.support:support-v4:19.0.0'
and compile / target sdk to 19
并将 sdk 编译/目标为 19