简体   繁体   English

ANDROID没有R.java

[英]ANDROID there is no R.java

Something weird... I was under the impression that R.java is created automatically by the Android platform (ADT). 奇怪的是......我认为R.java是由Android平台(ADT)自动创建的。

My question is as follows: 我的问题如下:

When I start Eclipse Mobile Juno 32 bit for Windows and go to the project I was working the day before, I find that I have an empty gen folder (there is no R.java, etc). 当我为Windows启动Eclipse Mobile Juno 32位并转到我前一天工作的项目时,我发现我有一个空的gen文件夹(没有R.java等)。

What should I do to prevent this from happening? 我该怎么做才能防止这种情况发生? It is really annoying... 这真烦人......

Thanks. 谢谢。

There are many posts on stackoverflow, which give suggestions regarding this. stackoverflow上有很多帖子,提供了相关的建议。 However what I can say with my experience is that, whenever R.java is not formed, their might be a error in some file. 然而,根据我的经验,我可以说,每当R.java没有形成时,它们可能是某个文件中的错误。 If not, then I just clean the open project and let it recompile. 如果没有,那么我只是清理打开的项目并让它重新编译。 Cleaning the project works most of the time for me. 清洁项目大部分时间都适用于我。

如果资源/布局出错,ADT将不会生成此文件。

You can try to clean the project by clicking project > clean. 您可以通过单击“项目”>“清理”来尝试清理项目。 This will clean your project. 这将清理您的项目。

Make sure you select the "Build Automatically" option just below the "clean" menu as well. 确保在“干净”菜单下方选择“自动构建”选项。 This way, each time you clean your project it will build the project automatically for you. 这样,每次清理项目时,它都会自动为您构建项目。

If the build hit an error, please post it. 如果构建遇到错误,请发布。

Please also make sure you are using the appropriate Java compiler and the Android version by checking on the project properties. 还请确保您通过检查项目属性来使用适当的Java编译器和Android版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM