Android Studio – Cannot resolve symbol ‘R’
来源:互联网 发布:java post 二进制 编辑:程序博客网 时间:2024/06/05 09:11
因要用到,所以最近学了点Android开发,用的编译器是亲儿子,也是新生儿 Android Studio。
今天在调试的时候,Android Studio 报了一个莫名其妙的错误Cannot resolve symbol 'R'
让人不知所措。因为这东西根本不归我管啊,怎么会出现 Cannot resolve symbol 这种错误呢?
谷歌了一下,找到解决方法如下:
- Build -> Clean Project
- Tools -> Android -> Sync Project With Gradle Files
不行就多试几次!就好了!
原因是什么?估计是没自动生成 R.java 文件。为什么会出现这样的问题?因为Android Studio是新生儿。。。。
再来看看一位遇到过此问题的网友的内心独白!Just For Fun!^_^
In every instance in all of my classes where i reference R.id.something the R is in red and it says “cannot resolve symbol R”, also every time there is R.layout.something it is underlined in red and says “cannot resolve method setContentView(?)”. The project however never fails to build and does work fine. It is just annoying to see this all the time. I have read many other questions on here about something similar but most involved importing projects from eclipse. I am using what i believe to be the most recent version of android studio and the project was created with android studio and worked without any cannot resolve R problems. I would like to know what causes this if anyone knows.
UPDATE: Please accept my apologies for never updating this. I solved my own problem since this has been posted. At the time android studio was brand new and I was also a brand new developer. I should never had been using android studio, I never realized how unfinished it was. Thanks everyone for the support in trying to help since this has been posted. Ironically the actual “answer” to this question has been deleted and cannot be undeleted. I feel that my original answer is the solution to this problem, in short don’t use android studio if you are new to android development.
- Android Studio – Cannot resolve symbol ‘R’
- Android Studio – Cannot resolve symbol ‘R’
- Android Studio – Cannot resolve symbol ‘R’
- Android Studio – Cannot resolve symbol ‘R’
- Android Studio :cannot resolve symbol R
- android studio Cannot resolve symbol 'R'
- android studio cannot resolve symbol R
- cannot resolve symbol r android studio
- android studio 的 cannot resolve symbol R
- android studio cannot resolve symbol 'R'
- “cannot resolve symbol R” in Android Studio
- “cannot resolve symbol R” in Android Studio
- Android Studio: cannot resolve symbol R
- Android studio里Cannot resolve symbol 'R'
- Android Studio-R错误 cannot resolve symbol R
- Android:Cannot resolve symbol’R’
- android Cannot resolve symbol'R'
- Android studio 下出现"Cannot resolve symbol R"的解决方法
- Opencv之二帧差法运动目标检测与轮廓提取
- Java: Random.nextInt() 和Math.random()的区别
- 现阶段对数据库中知识发现KDD、数据挖掘、集成学习、深度学习、机器学习、人工智能、统计学、大数据、云计算的个人理解:
- 给自己看的NIM
- Js实现京东大的轮播图及相关动画效果
- Android Studio – Cannot resolve symbol ‘R’
- catalan数
- $_SERVER详解
- POJ-1260 Pearls (dp)
- python——word2vec
- [tyvj1052]没有上司的舞会
- 关于relative和absolute属性
- ELK之Logstash
- 堆排序