R cannot be resolved to a variable
1. 检查Android 的SDK是否丢失需要重新下载,检查build
path,把需要导入的JAR包确认都导入成功
2. 确保class没有import Android.R,注意是不能有Android.R,可以有其他R文件,比如你自己的包;
3. 错误class引用的layout的xml文件没有错误,经常是xml里面有错误,导致R文件无法正常生成
很多时候都是这个地方出错,可以尝试在layout 的xml文件手写添加一个控件,看id能否在R.Java中自动生成,如果不能,那很大可能就是这个layout
的xml文件有问题,查看格式是否使用正确,或者包含什么非法字符串,或者调用到了不正确的字符串,等等,可以使用排除法,挨个去掉控件,直到发现error message消失或者id能在R.java中自动生成。记得以前经常因为android这个单词拼错而出现R文件无法正常生成而总是R cannot be resolved to a variable
4. 检查AndroidManifest.xml文件,里边的package,layout配置文件,strings.xml等的字符串全部书写正确.
5.删掉gen文件夹,使R.java重新自动生成一次,如果不能生成,继续检查layout的xml文件是否有如上不易发觉的问题
6.Clean project ,重新build,或者重新import project。
7.重启eclipse
8.重启电脑,以防Android 虚拟机的问题
原帖链接:http://blog.csdn.net/jason0539/article/details/9708025
R cannot be resolved to a variable的更多相关文章
- 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 ...
- Android 编译时出现r cannot be resolved to a variable
问题:编译出现r cannot be resolved to a variable 原因:SDK的Tools没有安装 解决:在Android SDK Manager中安装Tools部分,包括如下4项, ...
- Android开发 R cannot be resolved to a variable问题的分析
R文件是系统自动生成的,如果没出现的话,你的XML文件是不是有错误?是否之前修改过res文件夹下面.xml文件 R文件没有生成的情况有几种: 1.项目没有自动编译:这种时候只需要简单的编译一下工程就会 ...
- 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 ...
- Aandroid Error之 新导入工程报Unable to resolve target 'android-18'和R cannot be resolved
有段时间没有写安卓了,今天导入以前的项目,结果看到控制台打印出了这样一句:Unable to resolve target 'android-18', 解决方法: 项目->属性->Andr ...
- 网站开发进阶(十六)错误提示:Multiple annotations found at this line:- basePath cannot be resolved to a variable
错误提示:Multiple annotations found at this line: basePath cannot be resolved to a variable 出现以上错误,主要是由下 ...
随机推荐
- 【竞品分析】Android音乐播放器的竞品分析
迄今为止最长的一篇博客,各位看官笑纳~~ 本次分析基于Android平台,选取了几款我体验过的播放器进行比较分析.主要分为两类,一类是大而全的,功能全面,可满足用户管理歌曲.导入导出歌单等多方面需求, ...
- seajs的spm使用
压缩JS文件 只需要执行这个命令即可 spm build xxx.js 这时候你将得到一个压缩过的__build/xxx.js文件 合并JS文件 如果希望将JS文件中require的其他模块都合并到这 ...
- 1、Window10 Electron 开发环境搭建
1:首先安装nodejs C:\Users\yan>node -v v4.5.0 2:安装Electron C:\Users\yan>npm install --g electron-pr ...
- Silicon Labs电容式触摸感应按键技术原理及应用
市场上的消费电子产品已经开始逐步采用触摸感应按键,以取代传统的机械式按键.针对此趋势,Silicon Labs公司推出了内置微控制器(MCU)功能的电容式触摸感应按键(Capacitive Touch ...
- Solr -- Solr Facet 1
一.Facet介绍 solr facet 是solr搜索的一大特色,facet不好翻译,有说是垂直搜索,有说是分片搜索,但都不是很好,还是懒得翻译了,就叫facet ,具体功能看下面的例子意会吧. 比 ...
- ANDROID Porting系列二、配置一个新产品
ANDROID Porting系列二.配置一个新产品 详细说明 下面的步骤描述了如何配置新的移动设备和产品的makefile运行android. 1. 目录//vendor/创建一个公 ...
- Add external tool in the Android Studio
Add external tool in the Android Studio */--> pre { background-color: #2f4f4f;line-height: 1.6; F ...
- 上海Uber优步司机奖励政策(1月25日~1月31日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
- postgresql数据库的数据导出
一.pg_dump的用法:数据库的导入导出是最常用的功能之一,每种数据库都提供有这方面的工具,例如Oracle的exp/imp,Informix的dbexp/dbimp,MySQL的mysqldump ...
- c#基础语言编程-按值类型和引用类型传递参数
引言 在介绍传递参数介绍前,请明白参数类型和传递方式是不同的.传递方式分为按值类型和引用类型传递参数.参数类型有值类型和引用类型,这个和C++是不同的.这里的传递方式对应c++中的深复制和浅复制. 两 ...