Eclipse错误:R无法解析为变量 [英] Eclipse error: R cannot be resolved to a variable

查看:1435
本文介绍了Eclipse错误:R无法解析为变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse IDE中遇到这个经典错误。我厌倦了Eclipse的bug。他们让我疯狂。



我几乎尝试了所有建议作为解决方案(由谷歌搜索)。没有人工作。



我的项目正常工作,但没有代码更改。



我看到我的代码更改不会对我的应用程序(在AVD上)执行,然后我清理了我的项目(在 Project> Clean ... 下)。 R.java 文件已过,res文件夹为空。



现在我收到了错误: R无法解析为变量。



我该怎么办?



而且我也尝试删除项目并再次使用从现有代码中的Android项目创建我已经备份。清理后,已经有相同的错误。



任何想法都不胜感激。

解决方案>

我假设你已经更新了版本22的ADT,并且没有生成R.java文件。



如果是这种情况,那么这里是解决方案:



希望你知道Android studio有毕业生的工具。与eclipse相同,他们在Tools文件夹中提供了一个新的组件,这个文件夹叫做需要安装的Android SDK Build-tools。打开Android SDK管理器,选择新添加的构建工具,安装它,更新后重新启动SDK Manager。




I am getting this classic error in Eclipse IDE. I am bored of Eclipse's bugs. They driving me mad.

I almost tried everything which suggested as solution (by Googling). None of them worked.

My project was working normally but not code changes.

I see that my code changes does not acting on my app (on AVD) then I cleaned my project (under Project > Clean...). R.java file was gone and res folder was empty.

Now I am getting that error: R cannot be resolved to a variable.

What should I do?

And also I tried to delete project and create again with Android Project from Existing Code I've backed-up before. It already gives same error after cleaning.

Any ideas would be appreciated.

解决方案

I assume you have updated ADT with version 22 and R.java file is not getting generated.

If this is the case, then here is the solution:

Hope you know Android studio has gradle building tool. Same as in eclipse they have given new component in the Tools folder called Android SDK Build-tools that needs to be installed. Open the Android SDK Manager, select the newly added build tools, install it, restart the SDK Manager after the update.

这篇关于Eclipse错误:R无法解析为变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆