eclipse下android应用程序报错:R cannot be resolved to a variable
来源:互联网 发布:telnet 端口失败解决 编辑:程序博客网 时间:2024/06/06 00:36
资源描述:
Android开发过程中,碰到R cannot be resolved to a variable的报错信息,好像没有很确定的错误原因,一般来说,我总结出几个可能的解决方法,希望试过以后管用。。。
1. 检查Android 的SDK是否丢失需要重新下载,检查build path
2.确保class没有import Android.R;
3,错误class引用的layout的xml文件没有错误
4.检查AndroidManifest.xml文件,里边的package,layout配置文件,strings.xml等的字符串全部书写正确
5.layout的xml文件中引用的strings.xml中的字符串拼写完全正确
6.在layout 的xml文件手写添加一个控件,看id能否在R.java中自动生成,如果不能,那很大可能就是这个layout 的xml文件有问题,查看格式是否使用正确,或者包含什么非法字符串,或者调用到了不正确的字符串,等等,可以使用排除法,挨个去掉控件,直到发现error message消失或者id能在R.java中自动生成。
7.删掉gen文件夹,使R.java重新自动生成一次,如果不能生成,继续检查layout的xml文件是否有如上不易发觉的问题
8.Clean project ,重新build,或者重新import project。
9.重启eclipse
10.重启电脑,以防Android 虚拟机的问题
- eclipse下android应用程序报错:R cannot be resolved to a variable
- android新建工程R报错或者R cannot be resolved to a variable
- linux 下ADT R cannot be resolved to a variable
- R cannot be resolved to a variable
- r cannot be resolved to a variable
- R cannot be resolved to a variable
- R cannot be resolved to a variable
- R cannot be resolved to a variable
- R cannot be resolved to a variable
- R cannot be resolved to a variable
- R cannot be resolved to a variable
- R cannot be resolved to a variable
- R cannot be resolved to a variable
- R cannot be resolved to a variable
- R cannot be resolved to a variable
- R cannot be resolved to a variable
- R cannot be resolved to a variable
- R cannot be resolved to a variable
- ASIHTTPRequest系列(一):同步和异步请求
- USACO 1.1.4 Broken Necklace
- Codeforces 218B Airport
- 2013多校联合1部分题解(更新中)
- Onvif客户端出现“SOAP 1.2 fault: SOAP-ENV:Sender [no subcode]”错误解释
- eclipse下android应用程序报错:R cannot be resolved to a variable
- ORACLE 表连接详解
- Conversion to Dalvik format failed with error 1
- .net代码关机
- 键盘输入字符乱码
- Redis 如何处理客户端连接
- android开发,你还在犹豫什么呢?
- Android开发人员必须收藏的国外网站
- struts2,hibernate,spring下载整合所需JAR包