简体   繁体   English

Eclipse给我R无法解决可变错误,已经尝试了所有修复程序

[英]Eclipse Giving me the R cannot be resolved to a variable error, have tried every fix

I am getting the typical "R cannot be resolved to a variable error" but I have currently tried what I feel to be almost every "fix" and I still can't get it to work. 我正在得到典型的“ R无法解决可变错误”,但是我目前已经尝试了几乎所有“修复”的感觉,但仍然无法正常工作。 I think it has to do with the many errors I am getting from the res folder: 我认为这与从res文件夹得到的许多错误有关:

res\\values\\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. res \\ Property.xml:7:错误:检索项目的父项时出错:未找到与给定名称'Theme.AppCompat.Light'匹配的资源。

res\\values-v11\\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. res \\ Values-v11 \\ styles.xml:7:错误:检索项目父项时出错:未找到与给定名称'Theme.AppCompat.Light'匹配的资源。

res\\values-v14\\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. res \\ Values-v14 \\ styles.xml:8:错误:检索项目父项时出错:未找到与给定名称'Theme.AppCompat.Light.DarkActionBar'匹配的资源。

and the many other similar errors that are to do with the xml files in the appcombat_v7 folder. 以及与appcombat_v7文件夹中的xml文件有关的许多其他类似错误。

I have tried cleaning the project, building the project, I have updated my android sdk tools and ADT for eclipse to the newest version, I am using android 4.4 for the target of the project. 我尝试清理项目,构建项目,将Eclipse的android sdk工具和ADT更新为最新版本,我将android 4.4用于项目的目标。

any help would be nice 你能帮忙的话,我会很高兴

EDIT: Also get this error: WARNING: unable to write jarlist cache file H:\\Workspace\\appcompat_v7\\bin\\jarlist.cache And this on the activity_main.xml in the layout folder: The project target (Android 5.0) was not properly loaded. 编辑:也会收到此错误:警告:无法写入jarlist缓存文件H:\\ Workspace \\ appcompat_v7 \\ bin \\ jarlist.cache而这在布局文件夹中的activity_main.xml上:未正确加载项目目标(Android 5.0) 。

Delete these files 删除这些文件

  • res\\values\\styles.xml res \\ values \\ styles.xml
  • res\\values-v11\\styles.xml res \\ values-v11 \\ styles.xml
  • res\\values-v14\\styles.xml res \\ values-v14 \\ styles.xml

then in your manifest under aplication tag remove this line also 然后在您的资讯清单中,在[aplication]标签下移除这行

    android:theme="yourTheme"

or alternatively you can do one more thing. 或者您可以做一件事。 add the appCompact Library to Your project 将appCompact库添加到您的项目

it seems you are not importing appcompat support package... 看来您不是要导入appcompat支持包...

Adding the action bar when running on versions older than Android 3.0 (down to Android 2.1) requires that you include the Android Support Library in your application. 在低于Android 3.0(低于Android 2.1)的版本上运行时,添加操作栏需要在应用程序中包含Android支持库。

please follow the link for setting up the appcompat library 请点击链接以设置appcompat库

http://developer.android.com/tools/support-library/setup.html http://developer.android.com/tools/support-library/setup.html

Seems you have not imported appcompat_v7 properly. 似乎您没有正确导入appcompat_v7。 Try this: 尝试这个:
1. Right Click Project --> properties --> Android --> Library section --> Add appcompat_v7. 1.右键单击项目->属性-> Android->库部分->添加appcompat_v7。
2. Now clean and build everything. 2.现在清理并构建所有内容。

修改appcompat_v7和yourProject项目中的project.properties文件,从target=android-19target=android-21

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM