3

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 . what I need to do ? I'm expecting the valuable replies from which I could overcome this problem

Rakesh L
  • 132
  • 3
  • 10

5 Answers5

8

R.java is missing implicate that your resource folder is having some issues. please try to look at your resource files(layout,drawable etc). and after that clean the project. it will solve the problem for sure.

Dinesh Prajapati
  • 9,274
  • 5
  • 30
  • 47
3

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.

In Eclipse go to "Project --> Properties" and select "Builders" from the list.

Android Builders

Only if these builders are set, the R file can be generated.

Briareos386
  • 1,927
  • 18
  • 34
  • Your answer in my case is not effective on my project. Once I created a project, I noticed that there is no R file in the gen folder. What should I do? – David Dimalanta Jul 17 '13 at 04:02
  • @DavidDimalanta Have you already created a build? "Project => Build all" (maybe you have to uncheck "Build automatically") - are there any errors you get? If you don't succeed, please ask a new question. – Briareos386 Jul 17 '13 at 07:53
  • I have selected all the builders and clicked ok. I cleaned and build project again but still R.java is not generated. – Malwinder Singh Nov 15 '14 at 12:07
  • Hi @M.S. - would you mind opening a new question if all these answers didn't help you out? – Briareos386 Nov 24 '14 at 09:55
1

R.java missed only when there is some problem in resource files. Check properly your Menu files , layouts, and Drwables, (sometime same image names with .jpg and .png extensions are existeing).

Or you can create new project and paste everything in new project then check it again.

Mudassar Shaheen
  • 1,397
  • 1
  • 9
  • 15
  • There is no problem in resource files .Even if i create a new project the same problem occurs – Rakesh L Mar 04 '13 at 12:31
  • I can't see my logcat as I can't even run my project with this error .if I run my project a dialog shows that my project contains error(s),please fix them before running my application – Rakesh L Mar 04 '13 at 12:38
  • if you are using any menu xml please remove it for a while and test your project without using menu xml. then clean your project and test it. because some time there is some problem in menu file and eclipse dont indicate with red cross. – Mudassar Shaheen Mar 04 '13 at 12:45
0
  • click Project --> Build Automatically
  • check build automatically
  • clean the project
Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
0

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.

Abolfazl Miadian
  • 3,099
  • 2
  • 19
  • 15