简体   繁体   English

R.java给出错误

[英]R.java gives an error

My R.java gives an error 我的R.java报错

public static final int 1405308882_more = 0x7f020000 公共静态最终int 1405308882_more = 0x7f020000

Don't know or understand why its giving this error, i regenerate the R.java file and it still gives me the following above. 不知道或不明白为什么会出现此错误,我重新生成了R.java文件,但上面仍然给出了以下内容。 and when i hover my mouse over it, it says 当我将鼠标悬停在它上面时,它说

underscore have to be located within digits 下划线必须位于数字之内

I tried editing it but when it compiles it still regenerate the same name variable. 我尝试对其进行编辑,但在编译时仍会重新生成相同的名称变量。

Please before anyone starts rating this question as usless take your time to understand it I don't have error in any of my java files either in the src folder or layout folder every thing else is fine its just the R.java that generates that constant so please understand before you jump to conclusions. 请在任何人开始对此问题进行评分之前,请先花点时间来理解它,我在src文件夹或layout文件夹中的任何Java文件中都没有错误,其他所有事情都很好,只是生成该常量的R.java因此请先理解后再得出结论。 Thank you. 谢谢。

There might be some thing error in your res folder once check each and every file and clean your project once and refresh it again.. 一旦检查每个文件并清理项目一次并重新刷新,res文件夹中可能会出现一些错误。

Sounds like the R.java file has not updated, try some of these general pointers to begin with: 听起来R.java文件尚未更新,请尝试从以下一些常规指针开始:

  • Do not manually edit any of the files in the gen folder, as these are automatically built for you. 不要手动编辑gen文件夹中的任何文件,因为这些文件是为您自动生成的。
  • If you find it is out of sync then try refreshing the project. 如果发现不同步,请尝试刷新项目。
  • If that did not work try a clean (project -> clean) 如果这样不起作用,请尝试清理(项目->清理)
  • If that did not work delete the gen folder, from within Eclipse, (do not panic) it will then be rebuilt by Eclipse - however if there is a coding error of some sort it may not do this straight away. 如果这样做不起作用,则从Eclipse中删除gen文件夹(不要惊慌),然后它将由Eclipse重新构建-但是,如果出现某种编码错误,则可能不会立即执行此操作。

Hope this helps.. 希望这可以帮助..

It wasn't the XML file that was the issue. 问题不是XML文件。 It was an image in the resource folder with a name that didn't follow the standard naming rules and thus made the R.java to generate that error. 这是资源文件夹中的一个映像,其名称不符合标准命名规则,因此使R.java生成了该错误。

它重新生成的原因是相同的,因为它是从代码中重新生成的,因此您应该检查该项目的.xml文件,问题可能出在其中1个文件上,尝试清除已创建的xml,然后重新生成它。

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

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