Android开发 R cannot be resolved to a variable问题的分析
R文件是系统自动生成的,如果没出现的话,你的XML文件是不是有错误?是否之前修改过res文件夹下面.xml文件
R文件没有生成的情况有几种:
1、项目没有自动编译:这种时候只需要简单的编译一下工程就会有了。建议:选择菜单 Project ,勾选上 Bulid Automatically(自动构建部署)。
2、项目中res文件夹下面的内容有错误(例如layout文件),这种时候R文件也不会出现(或者更新),这种时候需要解决文件中的错误R文件才能生成。
3、项目中没有错误,但是R文件就是不生成。这个时候可能是工程选择的目的SDK的错误,例如你选择的是1.6,而在layout中用了一个:layout_height="match_parent" ,这时候R文件也不会生成了,因为layout_height="match_parent" 这种是在2.X以后才出现的。查看工程的SDK版本的方法:打开default.properties 文件,看target=android-7 ,或者在manifest文件中查看。
Android开发 R cannot be resolved to a variable问题的分析的更多相关文章
- Android 编译时出现r cannot be resolved to a variable
问题:编译出现r cannot be resolved to a variable 原因:SDK的Tools没有安装 解决:在Android SDK Manager中安装Tools部分,包括如下4项, ...
- R cannot be resolved to a variable问题
在调试android的时候,layout解析都正确,但是build project的时候提示" R cannot be resolved to a variable " 经过查找, ...
- Eclipse新建工程编译R cannot be resolved to a variable问题
Eclipse新建工程编译R cannot be resolved to a variable问题 新建工程编译提示R cannot be resolved to a variable 图1 然后打开 ...
- R cannot be resolved to a variable 解决办法
Android开发过程中,碰到R cannot be resolved to a variable的报错信息,好像没有很确定的错误原因,一般来说,我总结出几个可能的解决方法,希望试过以后管用... 1 ...
- R cannot be resolved to a variable
1. 检查Android 的SDK是否丢失需要重新下载,检查build path,把需要导入的JAR包确认都导入成功 2. 确保class没有import Android.R,注意是不能有Androi ...
- Android开发学习之路-Handler消息派发机制源码分析
注:这里只是说一下sendmessage的一个过程,post就类似的 如果我们需要发送消息,会调用sendMessage方法 public final boolean sendMessage(Mess ...
- Android 如何引用com.android.internal.R目录下的资源
Android 如何引用com.android.internal.R目录下的资源 项目需求 有一个资源跟系统上的一个资源相同,想要引用它:frameworks/base/core/res/res/dr ...
- Android开发中出现cannot be resolved to a variable错误,也就是R文件不能生成。
最近开始学过习Android开发,配置完成开发环境后,在创建第一个Android项目就出现了cannot be resolved to a variable错误,也就是R文件不能生成的问题. 以下是从 ...
- Android: R cannot be resolved to a varia...
Android: R cannot be resolved to a varia... 2012-07-27 10:58:32 上传者: wangdao下载(0) 浏览(57568) 评论(0 ...
随机推荐
- 网页 JavaScript
今天,我主要学习了JavaScript的部分内容. JavaScript在html中的位置主要有三个地方:head里面.body里面.</html>之后,我们一般写在</html&g ...
- <meta http-equiv="X-UA-Compatible" content="IE=Edge">
1.X-UA-Compatible X-UA-Compatible是IE8的一个专有<meta>属性,它告诉IE8采用何种IE版本去渲染网页,在html的<head>标签中使用 ...
- 安装免安装版的mysq服务的方法l
1.将安装包解压到没有中文的目录文件夹下,例如:D:\workspace\mysql-5.6.25-win32. 2.打开cmd窗口,进入到安装目录下, C:\Windows\system32> ...
- 三、oracle 用户管理(user)
一.创建用户概述:在oracle中要创建一个新的用户使用create user语句,一般是具有dba(数据库管理员)的权限才能使用.create user 用户名 identified by 密码; ...
- 浅谈hbase表中数据导出导入(也就是备份)
转自:http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=23916356&id=3321832 最近因为生产环境hbase ...
- 五种JSP页面跳转方法详解
1. RequestDispatcher.forward() 是在服务器端起作用,当使用forward()时,Servlet engine传递HTTP请求从当前的Servlet or JSP到另外一个 ...
- c语言-转义序列
字符组合是由反斜杠 (\) 后接字母或位组合构成的字符组合.若要显示换行符,单引号或某些其他字符在字符串末尾,必须使用转义序列. 转义序列被视为单个字符,因此,它是有效的字符常数. 转义序列通常用于指 ...
- JQuery中常用方法备忘
本文转载自博客园,原文地址 http://www.cnblogs.com/xzf158/archive/2008/10/14/logan.html 1.Window.onload 的JQuery方法 ...
- @Autowired 和 @Resource
转自:Spring中@Autowired注解.@Resource注解的区别 Spring不但支持自己定义的@Autowired注解,还支持几个由JSR-250规范定义的注解,它们分别是@Resourc ...
- gets()
C: #include <stdio.h> //这个头文件包含gets()函数,这个函数在ISO/IEC 9899 2011(C11)标准中被移除 int main(void) { ...