.layout.main总是在layout上有错误提示波浪线。

解决方法:

(1) 删除"import android.R;".
(2) 勾选上Eclipse中的"Project->Build
Automatically";

原因是:

添加文件,比如xml文件或者资源文件时,系统自动添加了import
android.R;android.R是系统提供的资源,R是应用程序的资源。删除"import
android.R"之后工程就是从/res文件夹下自动生成的资源文件里去解析了,否则它会从Android的资源类里去找。

“main cannot be resolved or is not a field”解决方案的更多相关文章

  1. main cannot be resolved or is not a field

    今天在做XML解析的时候,总是给我报 XML Parsing Error: XML or text declaration not at start of entity 的错误,后来查了下讲大概意思是 ...

  2. layout cannot be resolved or is not a field

    去除代码activity代码页面顶部中的 import android.R;这句就可以消除红色波浪线的main cannot be resolved or is not a field类似这个错误了

  3. Andrion错误解决:cannot be resolved or is not a field

    cannot be resolved or is not a field   解决这个问题:   选择project菜单中的clean,选择你的项目,先clean一下, 再去看看Activity中有没 ...

  4. "cannot be resolved or is not a field"问题解决 (转载)

    转自:http://blog.csdn.net/liranke/article/details/16803295 在修改了资源文件后,出现“"cannot be resolved or is ...

  5. R.layout.main cannot be resolved解决办法

    今天敲的代码 package com.sharpandroid.activity; import android.R; import android.app.Activity; import andr ...

  6. R.layout.main connot be resolved 和R.java消失

    出现例如以下问题: 鼠标放到出代码上面: 分析问题: 1.查看R文件是否被生成.假设没有生成,则勾选build Automatically,然后Clean: 2.假设R文件已生成.则删除去掉代码中: ...

  7. 出现 cannot be resolved or is not a field 错误

    删除R.Java文件,这时,系统会重新生成一个R.java; 删除java代码中的"import Android.R"文件. 重新导入正确的包.

  8. R.id.layout等不能识别:cannot be resolved or is not a field

    Do not modify the R class. The error means there's something syntactically wrong with your XML layou ...

  9. Android错误之--activity_main cannot be resolved or is not a field

    一般在copy别人的项目中会easy出现本错误,截图例如以下:

随机推荐

  1. firefox常用扩展、脚本

    1.AutoPopup.uc.js:鼠标移到菜单和下拉箭头上自动弹出下拉菜单 2.moveButton.uc.js:移动或克隆按钮或菜单到火狐浏览器的任意位置 moveButton.uc.js使用说明 ...

  2. 2875: [Noi2012]随机数生成器 - BZOJ

    DescriptionInput 包含6个用空格分割的m,a,c,X0,n和g,其中a,c,X0是非负整数,m,n,g是正整数. Output 输出一个数,即Xn mod gSample Input ...

  3. IOS7 适配时导航栏变黑

    当适配IOS的布局时遇到问题:导航栏和菜单栏后台会变黑色. self.edgesForExtendedLayout = UIRectEdgeNone; 原因是系统默认这两个控件是半通明的. 解决方案: ...

  4. 【转】成为it精英,我奋斗7年

    转载地址:http://liangwang985.blog.163.com/blog/static/119549233201191394259491/ 这些日子 我一直在写一个实时操作系统内核,已有小 ...

  5. netbeans 7安装xdebug调试php程序

    1.下载安装xdebug 先从xdebug官网下载对应php版本的xdebug组件,下载地址是:http://www.xdebug.org/download.php 如果不确定下载哪个版本的xdebu ...

  6. POJ 1674

    #include<iostream>//cheng da cai zi 08 .11 .13 using namespace std; int main() { int digit_num ...

  7. **【ci框架】PHP的CI框架集成Smarty的最佳方式

    因为CI自带的模板功能不是很方便,所以大家普遍采用集成Smarty的方式来弥补CI这方面的不足. 本人在网上看了不少CI集成Smarty的教程,包括咱们CI论坛里面的一个精华帖子 http://cod ...

  8. hdu2544 最短路

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=2544 最短路径DIJKSTRA #include<stdio.h> #include<m ...

  9. 使用post()方法以POST方式从服务器发送数据

    使用post()方法以POST方式从服务器发送数据 与get()方法相比,post()方法多用于以POST方式向服务器发送数据,服务器接收到数据之后,进行处理,并将处理结果返回页面,调用格式如下: $ ...

  10. lintcode :搜索二维矩阵

    题目: 搜索二维矩阵 写出一个高效的算法来搜索 m × n矩阵中的值. 这个矩阵具有以下特性: 每行中的整数从左到右是排序的. 每行的第一个数大于上一行的最后一个整数. 样例 考虑下列矩阵: [ [1 ...