简体   繁体   English

意外删除的R.java

[英]Accidentally Deleted R.java

I was doing some work on my app when I accidentally deleted the file R.java in the gen folder. 当我意外删除gen文件夹中的文件R.java时,我正在对我的应用程序进行一些工作。 Is there any way to get it back? 有什么办法找回它吗? I need it because it is giving ever activity errors. 我需要它,因为它给活动带来了错误。 I tried copying my data into another application and that didn't work. 我尝试将数据复制到另一个应用程序中,但没有用。 I also checked my recycle bin and there was no file and cleaned. 我还检查了回收站,没有文件被清理。 Please help? 请帮忙?

Several ways to get out: 几种逃脱方式:

  1. Simply modify(add a white space or so) in one of your resource files and save it, if the eclipse is enabled 'build automatically', the R.java will be re-generated again. 只需在您的一个资源文件中修改(添加空格左右)并将其保存,如果启用了“自动构建”蚀,则R.java将再次重新生成。
  2. Go to project - clean project, clean your project and it will be re-generated when you run the project again 转到项目-清理项目,清理项目,当您再次运行项目时,它将重新生成

It is automatically generated file 它是自动生成的文件

Just clean and rebuild you project If there is no error{there must not any xml error which neither shown error nor let R.java build} then it will create your R.java file 只是清理并重建您的项目如果没有错误{没有任何xml错误,既没有显示错误,也没有让R.java建立},那么它将创建您的R.java文件

again 再次

Every Successful build just re-create new R.java file 每个成功的构建都只是重新创建新的R.java文件

R.java is auto generated when you delete it, make sure the xml file has no error . 删除R.java是自动生成的,请确保xml文件没有错误。 If this is also not solving your problem the start doing your project from scratch no copy paste. 如果这也不能解决您的问题, 请从头开始做项目,不要复制粘贴。

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

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