eclipse 在eclipse上清理项目后如何重新生成R.java?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11430721/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to regenerate R.java after clean projet on eclipse?
提问by Angelika
I'm working on android 2.3.3 , when I clean my project on eclipse the generated class R.java is deleted , I tried to fix the projects properties by a right click and choosing Android tools , but it does not works.
How can I regenerate the R.java ?
Thank you
我正在 android 2.3.3 上工作,当我在 eclipse 上清理我的项目时,生成的类 R.java 被删除,我尝试通过右键单击并选择 Android 工具来修复项目属性,但它不起作用。
如何重新生成 R.java ?
谢谢
回答by Silambarasan Poonguti
In Eclipse : Select Help > check Updates... Select the Installed Software tab. Click Update... If an update for ADT is available, select it and clickFinish. Restart Eclipse.
在 Eclipse 中:选择 Help > check Updates... 选择 Installed Software 选项卡。单击更新... 如果 ADT 的更新可用,请选择它并单击完成。重新启动 Eclipse。
回答by Rakshi
If there are any errors in the layout or any resource files there will be no build happening and the R.java
file will not be created.
如果布局或任何资源文件中有任何错误,则不会进行构建,R.java
也不会创建文件。
Please solve the errors and then try to clean the project.
请解决错误,然后尝试清理项目。
回答by user2111849
Everytime you clean the project and it rebuilds, it imports
每次清理项目并重建时,它都会导入
import.android.R
导入.android.R
so, delete this import and remove all errors from xml files. It will work.
因此,删除此导入并从 xml 文件中删除所有错误。它会起作用。
回答by Radu Toader
Also if you tried to speed up eclipse and unchecked Preferences - > General -> Startup and Shutdown - > Android Development Toolkitcheck it back and restart eclipse, then R will generate automatically
此外,如果您尝试加速 eclipse 并且未选中 Preferences -> General -> Startup and Shutdown -> Android Development Toolkit检查并重新启动 eclipse,那么 R 将自动生成