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 ...
随机推荐
- Colorful(Folders星语多彩文件夹) v1.7绿色版
软件名称:星语多彩文件夹ColorfulFolders v1.7绿色版软件类别:国产软件运行环境:WinXP/2003/Vista/Win7/Win2008软件语言:简体中文授权方式:免费版软件大小: ...
- yii2.0图片上传
在根目录下夹uploads文件夹 控制器 UploadController.php <?php namespace frontend\controllers; use Yii; use fron ...
- Flask -- 会话
会话session 在不同请求间存储特定用户的信息.它是在 Cookies 的基础上实现的,并且对 Cookies 进行密钥签名.这意味着用户可以查看你 Cookie 的内容,但却不能修改它,除非用户 ...
- MySQL 不允许从远程访问的解决方法
解决方法: 1. 改表法. 可能是你的帐号不允许从远程登陆,只能在localhost.这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 ...
- HTML之打开/另存为/打印/刷新/查看原文件等按钮的代码
■打开■ <input name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开> < ...
- cpanel 定时运行sh/php
php -q /home/用户/public_html/cron.php -------------------php格式 /home/用户/public_html ...
- spark 编程向导
http://spark.apache.org/docs/latest/programming-guide.html
- 深入理解HTTP协议(转) 浏览器和服务器如何通信(HTTP协议)
http协议学习系列 1. 基础概念篇 1.1 介绍 HTTP是Hyper Text Transfer Protocol(超文本传输协议)的缩写.它的发展是万维网协会(World Wide Web C ...
- IoC容器Autofac正篇之类型关联(服务暴露)(八)
类型关联 类型关联就是将类挂载到接口(一个或多个)上去,以方便外部以统一的方式进行调用(看下例). 一.As关联 我们在进行手动关联时,基本都是使用As进行关联的. 1 2 3 4 5 6 7 8 ...
- poj 2533 Longest Ordered Subsequence(LIS)
Description A numeric sequence of ai is ordered ifa1 <a2 < ... < aN. Let the subsequence of ...