Android项目一下子毁了,不能求R对象 [英] Android project suddenly ruined, can't find R object

查看:216
本文介绍了Android项目一下子毁了,不能求R对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

研究不能被解析为一个变量。于是,我就做修复项目设置,但它不能识别它的所有subcontent,比如从我的 XML 研究对象.id.X R.drawable.Y ,他们没有被识别。

我只是试图按照 http://developer.android.com /guide/topics/ui/controls/pickers.html 指导,并添加这样的类有选择时间的对话框。

 描述资源路径位置类型
用户不能得到解决或不是一个领域MainActivity.java / RemoteSwitch / src目录/ COM /例子/ remoteswitch线170 Java问题
ic_launcher不能得到解决或不是一个领域MainActivity.java / RemoteSwitch / src目录/ COM /例子/ remoteswitch线159 Java问题
关于解决不了的,或者不是一个领域MainActivity.java / RemoteSwitch / src目录/ COM /例子/ remoteswitch线136 Java问题
menu_user不能得到解决或不是一个领域MainActivity.java / RemoteSwitch / src目录/ COM /例子/ remoteswitch线133 Java问题
imp_logo不能得到解决或不是一个领域MainActivity.java / RemoteSwitch / src目录/ COM /例子/ remoteswitch线198 Java问题
activity_main不能得到解决或不是一个领域MainActivity.java / RemoteSwitch / src目录/ COM /例子/ remoteswitch线44 Java问题
timerCB不能得到解决或不是一个领域MainActivity.java / RemoteSwitch / src目录/ COM /例子/ remoteswitch线64 Java问题
timerTime不能得到解决或不是一个领域MainActivity.java / RemoteSwitch / src目录/ COM /例子/ remoteswitch线65 Java问题
状态文本不能得到解决或不是一个领域MainActivity.java / RemoteSwitch / src目录/ COM /例子/ remoteswitch线66 Java问题
timerText不能得到解决或不是一个领域MainActivity.java / RemoteSwitch / src目录/ COM /例子/ remoteswitch线67 Java问题
START_BUTTON不能得到解决或不是一个领域MainActivity.java / RemoteSwitch / src目录/ COM /例子/ remoteswitch线68 Java问题
stop_button不能得到解决或不是一个领域MainActivity.java / RemoteSwitch / src目录/ COM /例子/ remoteswitch线69 Java问题
activity_main不能得到解决或不是一个领域MainActivity.java / RemoteSwitch / src目录/ COM /例子/ remoteswitch线123 Java问题
menu_url不能得到解决或不是一个领域MainActivity.java / RemoteSwitch / src目录/ COM /例子/ remoteswitch线130 Java问题


解决方案

不要项目 - >清除数次

和和构建项目。

如果您仍然无法找到 R.java 文件夹,请检查您是否在任何错误的布局文件,例如检查是否所有的 XML文件可绘制在小写字母只命名。

删除这些错误后,清理并生成一次。

R cannot be resolved to a variable. So I tried to do "fix project setup", but then it can't identify all of its subcontent, such as objects from my xml, R.id.X, R.drawable.Y, none of them are identified.

I just tried to follow http://developer.android.com/guide/topics/ui/controls/pickers.html guide and add such class to have a dialog for choosing time.

    Description Resource    Path    Location    Type
users cannot be resolved or is not a field  MainActivity.java   /RemoteSwitch/src/com/example/remoteswitch  line 170    Java Problem
ic_launcher cannot be resolved or is not a field    MainActivity.java   /RemoteSwitch/src/com/example/remoteswitch  line 159    Java Problem
about cannot be resolved or is not a field  MainActivity.java   /RemoteSwitch/src/com/example/remoteswitch  line 136    Java Problem
menu_user cannot be resolved or is not a field  MainActivity.java   /RemoteSwitch/src/com/example/remoteswitch  line 133    Java Problem
imp_logo cannot be resolved or is not a field   MainActivity.java   /RemoteSwitch/src/com/example/remoteswitch  line 198    Java Problem
activity_main cannot be resolved or is not a field  MainActivity.java   /RemoteSwitch/src/com/example/remoteswitch  line 44 Java Problem
timerCB cannot be resolved or is not a field    MainActivity.java   /RemoteSwitch/src/com/example/remoteswitch  line 64 Java Problem
timerTime cannot be resolved or is not a field  MainActivity.java   /RemoteSwitch/src/com/example/remoteswitch  line 65 Java Problem
statusText cannot be resolved or is not a field MainActivity.java   /RemoteSwitch/src/com/example/remoteswitch  line 66 Java Problem
timerText cannot be resolved or is not a field  MainActivity.java   /RemoteSwitch/src/com/example/remoteswitch  line 67 Java Problem
start_button cannot be resolved or is not a field   MainActivity.java   /RemoteSwitch/src/com/example/remoteswitch  line 68 Java Problem
stop_button cannot be resolved or is not a field    MainActivity.java   /RemoteSwitch/src/com/example/remoteswitch  line 69 Java Problem
activity_main cannot be resolved or is not a field  MainActivity.java   /RemoteSwitch/src/com/example/remoteswitch  line 123    Java Problem
menu_url cannot be resolved or is not a field   MainActivity.java   /RemoteSwitch/src/com/example/remoteswitch  line 130    Java Problem

解决方案

Do Project -> Clean for a few times.

And then Build the project.

If you still cant find R.java in the gen folder, check if you have ANY errors in your layout files, for example check if all your xml files and drawables are named only in lower-case letters.

After removing these errors, Clean and Build once again.

这篇关于Android项目一下子毁了,不能求R对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆