【android调试】R cannot be resolved to a variable
2015-04-21 23:33
405 查看
原文地址:http://blog.sina.com.cn/s/blog_8a94d82b0101bdfb.html
真是奇怪,第一次导入一个项目时,竟然没有产生R.java文件,结果程序中一大堆错误,全是R cannot be resolved to a variable。
结果上网搜了半天,结果是
第一个查到的方法:
很多人碰到创建新工程的时候出现 cannot be resolved to a variable的问题时没法在第一时间得到最好的解决
其根本原因是r.java文件没有自动生成
关于一般的解决方案在网上很多人提出来了
比如CLEAN工程,CLEAN UP RESOURCE,Android Tools >> Fix Project Properties 等
但还是部分人看了网上的帖还不能解决,那么请注意两点:
1. 如果你在更新下载SDK,那么先关闭,重启ECLIPSE便可
2. 如果还不行,则更新完整ADT、SDK
本文出自 “清风柳絮” 博客,请务必保留此出处/article/6944646.html
第二个查到的方法:
*Note: Eclipse sometimes likes to add an "import android.R" statement at the top of your files that use resources, especially when you ask Eclipse to sort or otherwise manage imports. This will cause your make to break. Look out for these erroneous
import statements and delete them.*
While going through the Android sample tutorials, I would often use the Ctrl + Shift + O command to "Organize Imports" and generate any missing import statements. Sometimes this would generate the incorrect import statement
which would hide the
自我感觉应该是生成R.java的过程被打断了或发生了意外,于是删除原来的项目,重新导入,
哦哦,这次真的就成了!自动产生了R.java文件。呵呵
真是奇怪,第一次导入一个项目时,竟然没有产生R.java文件,结果程序中一大堆错误,全是R cannot be resolved to a variable。
结果上网搜了半天,结果是
第一个查到的方法:
很多人碰到创建新工程的时候出现 cannot be resolved to a variable的问题时没法在第一时间得到最好的解决
其根本原因是r.java文件没有自动生成
关于一般的解决方案在网上很多人提出来了
比如CLEAN工程,CLEAN UP RESOURCE,Android Tools >> Fix Project Properties 等
但还是部分人看了网上的帖还不能解决,那么请注意两点:
1. 如果你在更新下载SDK,那么先关闭,重启ECLIPSE便可
2. 如果还不行,则更新完整ADT、SDK
本文出自 “清风柳絮” 博客,请务必保留此出处/article/6944646.html
第二个查到的方法:
*Note: Eclipse sometimes likes to add an "import android.R" statement at the top of your files that use resources, especially when you ask Eclipse to sort or otherwise manage imports. This will cause your make to break. Look out for these erroneous
import statements and delete them.*
While going through the Android sample tutorials, I would often use the Ctrl + Shift + O command to "Organize Imports" and generate any missing import statements. Sometimes this would generate the incorrect import statement
which would hide the
R.javaclass that is automatically generated when you build.
自我感觉应该是生成R.java的过程被打断了或发生了意外,于是删除原来的项目,重新导入,
哦哦,这次真的就成了!自动产生了R.java文件。呵呵
相关文章推荐
- android调试】R cannot be resolved to a variable) R.java 不能自动生成
- Android程序报R cannot be resolved to a variable 问题
- Android: R cannot be resolved to a variable 解决办法
- android开发出现R cannot be resolved to a variable 问题解决办法之一
- 工具问题——android升级ADT22之后新建android项目提示R cannot be resolved to a variable
- android之R cannot be resolved to a variable
- android Toast报错 Activity context.this cannot be resolved to a variable
- Android: R cannot be resolved to a variable
- eclipse下android应用程序报错:R cannot be resolved to a variable
- r cannot be resolved to a variable 问题解决 / r.java文件没有自动生成 分类: Android安装及配置 2014-06-22 18:03 141人阅读 评论(0) 收藏
- android_error:R cannot be resolved to a variable
- Android 编译时出现r cannot be resolved to a variable
- android r cannot be resolved to a variable 错误以及 所有的文件没有报错但是项目报错
- Android开发:“R cannot be resolved to a variable”的解决方法
- Android: R cannot be resolved to a variable
- android Toast报错 Activity context.this cannot be resolved to a variable
- android新建工程R报错或者R cannot be resolved to a variable
- 工具问题——android升级ADT22之后新建android项目提示R cannot be resolved to a variable
- Android: R cannot be resolved to a variable
- Android: R cannot be resolved to a variable