简体   繁体   English

未找到Android- R.java文件

[英]Android- R.java file not found

While working with an android project .I'm stuck with R.java file which is not found even I clean the project(project---->clean).But that file still not found .Even I create a new project the same problem occurs . 在使用android项目时。我坚持使用R.java文件,即使我清理项目也没有找到(项目---->干净)。但是那个文件仍然没有找到。即使我创建了一个新的项目相同出现问题。 what I need to do ? 我需要做什么 ? I'm expecting the valuable replies from which I could overcome this problem 我期待着能够克服这个问题的宝贵回复

R.java is missing implicate that your resource folder is having some issues. R.java缺少暗示您的资源文件夹存在一些问题。 please try to look at your resource files(layout,drawable etc). 请尝试查看您的资源文件(布局,可绘制等)。 and after that clean the project. 然后清理项目。 it will solve the problem for sure. 它肯定会解决问题。

Have you checked that your builders are set up correct? 您是否检查过您的建造商设置正确? To have the R.java file generated there's a need that the Android Pre-Compiler has processed all the resources. 要生成R.java文件,需要Android预编译器处理所有资源。

In Eclipse go to "Project --> Properties" and select "Builders" from the list. 在Eclipse中,转到“项目 - >属性”,然后从列表中选择“构建器”。

Android Builders

Only if these builders are set, the R file can be generated. 只有设置了这些构建器,才能生成R文件。

R.java missed only when there is some problem in resource files. R.java只在资源文件出现问题时才会错过。 Check properly your Menu files , layouts, and Drwables, (sometime same image names with .jpg and .png extensions are existeing). 正确检查菜单文件 ,布局和Drwables(有时会显示与.jpg和.png扩展名相同的图像名称)。

Or you can create new project and paste everything in new project then check it again. 或者您可以创建新项目并将所有内容粘贴到新项目中,然后再次检查。

  • click Project --> Build Automatically 单击项目 - >自动构建
  • check build automatically 自动检查构建
  • clean the project 清理项目

simple way! 简单的方法! go to import section (top of current java class) and remove wrong import R, then go over the R and click Alt+Enter, then android studio import true R. 转到导入部分(当前java类的顶部)并删除错误的导入R,然后查看R并单击Alt + Enter,然后android studio import true R.

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

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