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

出现本错误的一般有两种情况

第一种情况:导包错误--检查import,找到这个:

删除之,再又一次导入含有包名的R文件。

另外一种情况:本情况应该更为多见。一般为布局文件里有错误,而无法生存R文件。能够检查一下:

你会发现果真没有生成R文件。这时你须要解决的就是查找布局文件里的错误,改正错误,生成R文件之后,本错误就会消失啦!

喜欢的朋友关注我的微信平台哦!

很多其它好的文章推荐给你!

Android错误之--activity_main cannot be resolved or is not a field的更多相关文章

  1. android 错误收集

    2. is not translated in Eclipse > Preference > Android > Lint Error Checking的Correctness: M ...

  2. Gradle DSL method found: ‘android()’错误

    Gradle DSL method found: ‘android()’错误 和上个错误一样这个也是因为在新版本的Gradle中android()方法已经废弃,但是要注意android()只是在整个项 ...

  3. Error:Execution failed for task ':app:preDebugAndroidTestBuild'. > Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app

    出现的问题: Error:Execution failed for task ':app:preDebugAndroidTestBuild'.> Conflict with dependency ...

  4. Conflict with dependency 'com.android.support:support-annotations' in project ':xxx'. Resolved versions for app (25.4.0) and test app (27.1.1) differ 问题解决

    Conflict with dependency 'com.android.support:support-annotations' in project ':xxx'. Resolved versi ...

  5. Android - 错误:"No resource found that matches the given name android:Theme.Material"

    Android - 错误:"No resource found that matches the given name android:Theme.Material" 本文地址:  ...

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

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

  7. layout cannot be resolved or is not a field

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

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

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

  9. matlab里textread出现错误“Trouble reading floating point number from file (row 1, field 1)”

    matlab里textread出现错误“Trouble reading floating point number from file (row 1, field 1)” 解决办法:traindata ...

随机推荐

  1. 定时任务框架-quartz

    依赖 <!-- 定时任务jar --> <dependency> <groupId>org.quartz-scheduler</groupId> < ...

  2. ylbtech-LanguageSamples-Pinvoke(平台调用)

    ylbtech-Microsoft-CSharpSamples:ylbtech-LanguageSamples-Pinvoke(平台调用) 1.A,示例(Sample) 返回顶部 “平台调用”示例 本 ...

  3. Android检测网络连接

    Android检测网络连接 import android.app.AlertDialog; import android.content.Context; import android.content ...

  4. PhpStorm 对 AngularJS 的支持

    非常喜爱用AngularJS来构建web应用程序的前端吗? PhpStorm 使得在其上进行 AngularJS 相关的工作同其它得到IDE支持的编程语言的工作一样容易! AD:51CTO首届中国AP ...

  5. Linux 设备驱动--- 并发 与 竞态 --- atomic_t --- atomic_dec_and_test --- 原子操作

    并发: 多个执行单元同时被执行. 竞态: 并发的执行单元对资源 ( 硬件资源和软件上的全局变量等 ) 的访问导致的竞争状态. 并发的处理: 处理并发的常用技术是加锁或者互斥,即保证在任何时间只有一个执 ...

  6. px、em、rem的区别

    一.PX: px像素(Pixel):相对长度单位.像素px是相对于显示器屏幕分辨率而言的. PX特点 1. IE无法调整那些使用px作为单位的字体大小: 2. 国外的大部分网站能够调整的原因在于其使用 ...

  7. Newtonsoft.Json.4.5.11使用方法总结---反序列化json字符串

    写在开头: 最近项目需求,需要在C#中处理json字符串,毫不犹豫的下载了Newtonsoft.Json 4.5.11(2012.12.17)http://json.codeplex.com/,然后百 ...

  8. java线程总结(2/5)

    线程基本信息和优先级别 方  法 功        能 isAlive() 判断线程是否还“活”着,即线程是否还未终止. getPriority() 获得线程的优先级数值 setPriority() ...

  9. Windows编译OpenSSL

    安装说明參考openssl源代码目录下INSTALL.W32 step1 环境搭建 安装perl,Visual Studio 2008 下载Openssl最新版源代码.我下的版本号为OpenSSL-1 ...

  10. C#运行原理——我的柔情你永远不懂

    记得歌手陈琳曾经在1993年发行了第一张专辑<你的柔情我永远不懂>,创造了150万张的销售纪录,里边的主打歌——我的柔情你永远不懂,多年以后才发现是写给C#运行原理的,因为原理总是伤不起~ ...