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

4
  • delete gen folder and build your project works?? Commented Mar 4, 2013 at 13:03
  • i am not sure but try it if it works ... right click on your project go to Android Tools and click on Fix Project Properties..and then delete gen folder and build it again?? Commented Mar 4, 2013 at 13:16
  • Remove, if any import android.R; Commented Mar 4, 2013 at 13:19
  • I already done the steps you told, but no change Commented Mar 4, 2013 at 13:42

5 Answers 5

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.

Sign up to request clarification or add additional context in comments.

3 Comments

There is no problem in resource files .Even if i create a new project the same problem occurs
Then android target is not set. project->right click->Properties->android and set the android target
If the android Target is not set .The library classes like Activity ,won't import.Anyhow,I've set my project to API 17
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.

4 Comments

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?
@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.
I have selected all the builders and clicked ok. I cleaned and build project again but still R.java is not generated.
Hi @M.S. - would you mind opening a new question if all these answers didn't help you out?
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.

3 Comments

There is no problem in resource files .Even if i create a new project the same problem occurs
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
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.
0
  • click Project --> Build Automatically
  • check build automatically
  • clean the project

2 Comments

I did that .But no change occurs
I have face this problem many time but everytime due to this problem only ,you can try restarting eclipse , mean while i ll try what else can i find for you
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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.