http://hi.baidu.com/mycollection/item/5f62fbeada78120d65db00ac
引用
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 虚拟机的问题
再不行的话,就自求多福了,查查其他地方
分享到:
相关推荐
> ★Http cannot be resolved to a variable > ★HttpEntity cannot be resolved to a type > ★EntityUtils cannot be resolved > ★HttpResponse cannot be resolved to a type > ★DefaultHttpClient cannot be ...
主要介绍了详解 问题:HttpServlet cannot be resolved to a type的相关资料,需要的朋友可以参考下
导入工程的“The import android cannot be resolved”错误解决方法
主要介绍了java eclipse 出现 xxx cannot be resolved to a type 错误解决方法的相关资料,需要的朋友可以参考下
测试类报错Test cannot be resolved to a type-附件资源
cocos The import com.loopj cannot be resolved 是缺失了jar包。导入lib文件夹,或者刷新eclipse就好了。
org.apache.commons.lang.exception.NestableRuntimeException cannot be resolved 解决 替换JAR包即可
jce.jar/jsse.jar解决The import javax.crypto cannot be resolved的问题
用于初学着 对错误提示的解释理解 提高学习速度 还还学习吧 希望对你有帮助
JSONObject cannot be resolved to a type 是因为缺少对应的依赖包:org-json.rar 包的来源github的项目:https://github.com/stleary/JSON-java中的Readme可以找到依赖包的地址。
解决The type org.springframework.dao.support.DaoSupport cannot be resolved.bao报错
rsslib4j-0.2.jar jar包,解决java报错找不到资源包问题 The import org.gnu cannot be resolved。 报错 import org.gnu.stealthp.rsslib.*; RSSChannel、RSSException、RSSHandler、RSSItem、RSSParser
ITextRenderer cannot be resolved to a type 错误就是因为缺少这个jar包
JSONObject所必须要用到的6个包,他们分别是commons-beanutils-1.7.0.jar、commons-collections-3.1.jar、commons-lang-2.5.jar、commons-logging.jar、ezmorph-1.0.3.jar、json-lib-2.1-jdk15.jar
Android NDK *** could not be resolved
JSTL 标签 发生 uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application问题时解决方法
NULL 博文链接:https://zuoqiang.iteye.com/blog/1337682
用JAVA编写的一个Stratego游戏,类似于国内的军棋游戏,能够实现网络对战。附上源代码,编写类似游戏的同学可以借鉴借鉴。...PS:用eclipse运行出现错误:HelpFrame cannot be resolved to a type. 望高手解答。
HTTP Status 500 - The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application