.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. ios map 显示用户位置

    昨天遇到个奇怪的问题,用户的位置在地图中死活不显示,showUserLocation也设置了,最后发现是因为实现了 mapView protocol中的一个方法: -(MKAnnotationView ...

  2. 用matlab查找txt文档中的关键字,并把关键字后面的数据存到起来用matlab处理

    用matlab查找txt文档中的关键字,并把关键字后面的数据存到起来用matlab处理 我测了一组数据存到txt文件中,是个WIFI信号强度文档,里面有我们需要得到的数据,有没用的数据,想用matla ...

  3. [剑指OFFER] 斐波那契数列- 跳台阶 变态跳台阶 矩形覆盖

    跳台阶 一只青蛙一次可以跳上1级台阶,也可以跳上2级.求该青蛙跳上一个n级的台阶总共有多少种跳法. class Solution { public: int jumpFloor(int number) ...

  4. WP 类似扑克牌布局控件和类似扑克卡片控件

    一.说明 本文代码来源: <windows phone 7 程序设计> Charles Petzold 控件效果: 二.要点: 1.ItemControl.子项容器模板(ItemsCont ...

  5. Unity3d 一些 常见路径

    Application.persistentDataPath C:\Users\Administrator\AppData\LocalLow\Company Name\Product Name 如果改 ...

  6. mySql 自动备份数据库

    mysqldump -u root -proot -h 192.168.1.100 xqpd > 1.sqlcopy 1.sql D:\项目备份\工程_数据库-%date:~0,4%%date: ...

  7. 【leetcode】Majority Element (easy)(*^__^*)

    Given an array of size n, find the majority element. The majority element is the element that appear ...

  8. JsRender系列demo-对null 和boolen类型数据的探讨

    废话不说了,直接上代码 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <he ...

  9. hdu 2582 f(n) 数学

    打表找规律: 当n为质数是,GCD(n)=n; 当n为质数k的q次方时,GCD(n)=k; 其他情况,GCD(n)=1. 代码如下: #include<iostream> #include ...

  10. 使用load()方法异步请求数据

    使用load()方法通过Ajax请求加载服务器中的数据,并把返回的数据放置到指定的元素中,它的调用格式为: load(url,[data],[callback]) 参数url为加载服务器地址,可选项d ...