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问题的分析的更多相关文章

  1. Android 编译时出现r cannot be resolved to a variable

    问题:编译出现r cannot be resolved to a variable 原因:SDK的Tools没有安装 解决:在Android SDK Manager中安装Tools部分,包括如下4项, ...

  2. R cannot be resolved to a variable问题

    在调试android的时候,layout解析都正确,但是build project的时候提示" R cannot be resolved to a variable " 经过查找, ...

  3. Eclipse新建工程编译R cannot be resolved to a variable问题

    Eclipse新建工程编译R cannot be resolved to a variable问题 新建工程编译提示R cannot be resolved to a variable 图1 然后打开 ...

  4. R cannot be resolved to a variable 解决办法

    Android开发过程中,碰到R cannot be resolved to a variable的报错信息,好像没有很确定的错误原因,一般来说,我总结出几个可能的解决方法,希望试过以后管用... 1 ...

  5. R cannot be resolved to a variable

    1. 检查Android 的SDK是否丢失需要重新下载,检查build path,把需要导入的JAR包确认都导入成功 2. 确保class没有import Android.R,注意是不能有Androi ...

  6. Android开发学习之路-Handler消息派发机制源码分析

    注:这里只是说一下sendmessage的一个过程,post就类似的 如果我们需要发送消息,会调用sendMessage方法 public final boolean sendMessage(Mess ...

  7. Android 如何引用com.android.internal.R目录下的资源

    Android 如何引用com.android.internal.R目录下的资源 项目需求 有一个资源跟系统上的一个资源相同,想要引用它:frameworks/base/core/res/res/dr ...

  8. Android开发中出现cannot be resolved to a variable错误,也就是R文件不能生成。

    最近开始学过习Android开发,配置完成开发环境后,在创建第一个Android项目就出现了cannot be resolved to a variable错误,也就是R文件不能生成的问题. 以下是从 ...

  9. 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 ...

随机推荐

  1. ios书籍推荐

    1.Objective-C Programming  内容不多, 却都是精华, 有了一点 C 语言基础可以快速阅读此书, 大概一天时间就可以看完, 看完后对 iOS 开发能够有个基本的印象. 2.iO ...

  2. CentOS中文件夹基本操作命令

    摘自:http://www.centoscn.com/CentOS/help/2013/1024/1967.html 文件(夹)查看类命令 ls--显示指定目录下内容 说明:ls 显示结果以不同的颜色 ...

  3. jQuery中的方法

    jQuery中的方法来操作HTML标签中的属性 attr(name)    获取当前对象的指定的属性的值 attr(key,value)  给当前对象设置属性值 attr(properties)  一 ...

  4. 把excel数据导入mysql中

    适用:每列的数据都不是以逗号分隔. 1.在mysql建表,全部字段与表头相同且顺序一致 2.将excel另存为csv格式,用Editplus把CSV文件另存为UTF-8编码格式 3.执行load da ...

  5. Linux下将Mysql和Apache加入到系统服务里的方法

    Apache加入到系统服务里面: cp /安装目录下/apache/bin/apachectl /etc/rc.d/init.d/httpd 修改httpd 在文件头部加入如下内容: ### # Co ...

  6. 第三十七节,hashlib加密模块

    在使用hashlib模块时需要先 import hashlib 引入模块 用于加密相关的操作,代替了md5模块和sha模块,主要提供 SHA1, SHA224, SHA256, SHA384, SHA ...

  7. 《JS权威指南学习总结--第二章词法结构》

    第二章词法结构 内容要点: 一.注释 1. //表示单行注释 2. /*这里是一段注释*/ 3.一般编辑器里加注释是:选中要加注释的语句,按 ctrl+/ 二.直接量 所谓直接量,就是程序中直接使用的 ...

  8. Varnish && Varnish Cache

    1 1 1 Varnish https://www.varnish-cache.org/intro/index.html#intro Introduction to Varnish The basic ...

  9. java代码中 路径符号的写法

    String path="D:\\新建文件夹\\2.png"; File file=new File(path); System.out.println(file.exists() ...

  10. Go-new和make

    new返回指向struct的指针,new仅分配内存,而不对对象的值进行初始化 make返回到strcut的对象,而不是指针,只能创建map,slice,channel对象 make([]string, ...