This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Android and the fly likes How to get back R.java  after cleaning the project in eclipse? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Mobile » Android
Bookmark "How to get back R.java  after cleaning the project in eclipse?" Watch "How to get back R.java  after cleaning the project in eclipse?" New topic
Author

How to get back R.java after cleaning the project in eclipse?

Vijay Nimkarde
Ranch Hand

Joined: Oct 16, 2008
Posts: 50
Hi ,
I have configured the Android SDK in eclipse and all things are working fine,
But when I clean the project in eclipse R.java cleans out and it is not possible to get
back
. How to get back R.java after clean the project in eclipse?

or Is this solution that ...Not to clean the project just build and run?
Thanks in Advanced .


Java Developer
Misha van Tol
Ranch Hand

Joined: Jan 02, 2010
Posts: 56

R.java should be re-created automatically when you clean a project. Does running build brings it back?
Vijay Nimkarde
Ranch Hand

Joined: Oct 16, 2008
Posts: 50
@ Misha van Tol
thanks for reply.
Yes I was tried by cleaning the project but there is shows errors at project icon in eclipse and project will not run because of error
and I dont understand what exactly error.
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

I also faced the same problem couple of times. R.java is a auto-generated file that stores information about your drawables. If after cleaning project and restarting eclipse doesn't solve your issue then you have to create new project and copy paste your code to new project.


Life is easy because we write the source code.....
Vijay Nimkarde
Ranch Hand

Joined: Oct 16, 2008
Posts: 50
Pramod P Deore wrote: If after cleaning project and restarting eclipse doesn't solve your issue then you have to create new project and copy paste your code to new project.

@ Pramod P Deore
Thats right ... but creating a new project after each time cleaning is not the proper way.
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

No need to create new project each time because after cleaning project every time you will not face this problem.
Peter Raftos
Greenhorn

Joined: Dec 15, 2010
Posts: 1
It's possible that Eclipse has decided to import your R.java file into one or more of your classes.

Every so often, when clean/build doesn't seem to be working, if I check my import block at the top of the class file(s) I'm writing, I'll see

import blah/R.java

(or similar).

Delete, save and rebuild. It fixes the problem for me. I wish I knew what caused it.
Jenifer Private
Greenhorn

Joined: Dec 16, 2010
Posts: 7
I have also experienced this problem. What works for me is to delete the "gen" directory then clean and rebuild. Works every time.
Vijay Nimkarde
Ranch Hand

Joined: Oct 16, 2008
Posts: 50
@ Jenifer Private and Peter Raftos
thanks guys your things realy works.
 
GeeCON Prague 2014
 
subject: How to get back R.java after cleaning the project in eclipse?