Jack welch
Jack welch

Reputation: 1707

Disappearance of R.java file

I was working on an android project and i pressed project->clean in eclipse and my R.java source file disappeared.Would anyone know the reason why

Upvotes: 0

Views: 137

Answers (5)

Lucifer
Lucifer

Reputation: 29632

Go to the Project Menu and select the option "Build Automatically". Probably this option was not "ticked" in your case. This is the reason when you clean your project eclipse hasn't created R.java again.

Upvotes: 2

Pedro Teran
Pedro Teran

Reputation: 1200

did you try to find it? I have a similar problem once. Because, eclipse program imported a library R.something so I just removed it and then clean project. and my R file appeared again

Upvotes: 0

Saurabh Verma
Saurabh Verma

Reputation: 6728

Whenever any project is cleaned, all the automatically generated files are deleted (hence your R.java got deleted), which is automatically generated again when the project is build successfully. Now, in your case R.java can't be generated which means there is some error in your resource - either in your xml files or drawables. These kinds of errors are shown in the console while you are trying to build the project

Upvotes: 0

Ben Taitelbaum
Ben Taitelbaum

Reputation: 7403

This file is dynamically generated, just Build the project again and it'll show up.

Upvotes: 1

salezica
salezica

Reputation: 76909

  1. Ensure there are no errors in your resource files (a bogus layout, drawable or whatever).

  2. Ensure the "Automatically build" option is set in the project menu.

  3. Try cleaning the project again.

  4. Try right-clicking the project -> Android tools -> fix project properties.

  5. Try manually building it.

If that didn't work, try restarting Eclipse.

If that didn't work, try running eclipse -clean

If that didn't work, try deleting the project without deleting the files, and re-importing it.

If that didn't work, well. I've no idea.

Upvotes: 0

Related Questions