刚学习android不久,练习了几个小程序,编译的时候老是出现一些让人摸不着头脑的错误。。其中有一个错误如题目所说,百度了一篇文章,觉得总结的比较全面,毕竟这个问题的出现不可能都是出于同一个原因。
搜来的总结如下:
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 虚拟机的问题
这些方法并没能解决我的问题,我的小程序是开发一个自定义的小View,在src文件夹中有一个自定义的View的源码和程序的源码,按住shift+ctri+o自动补全包的时候,有两个选择,一个是android.R,另一个是com.example.drawview.R。我的理解是要把本project的R文件导入进来才行,因为本project的R文件中有源码的索引。路过的高人如果有更好的想法还望不吝赐教。
分享到:
相关推荐
> ★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 ...
主要介绍了java eclipse 出现 xxx cannot be resolved to a type 错误解决方法的相关资料,需要的朋友可以参考下
导入工程的“The import android cannot be resolved”错误解决方法
测试类报错Test cannot be resolved to a type-附件资源
cocos The import com.loopj cannot be resolved 是缺失了jar包。导入lib文件夹,或者刷新eclipse就好了。
主要介绍了详解 问题:HttpServlet cannot be resolved to a type的相关资料,需要的朋友可以参考下
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
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
Word模板-授权委托书.wpt
The type org.apache.tools.ant.Task cannot be resolved. It is indirectly referenced from required .class files错误....., 解决办法:在工程中加入此jar包
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