Search code examples
androideclipser.java-file

R.java doesn't exist...but it does! Problem started after installing ADT 10.0.0


I get this error when I try to clean a project: ERROR: Unable to open class file ....R.java: No such file or directory

So I can't build my projects any more. But R.java is there in the gen folder and looks fine when I open it.

This happens to every one of my projects. I tried completely deleting the Eclipse folder and reinstalling it (Helios on Windows) and Android ADT. No luck.

I have also tried moving my workspace to a different drive. No luck.

I made sure all folders in my workspace are not read only. This worked the first time, but immediately the error came back when I cleaned my project.

This all started right after installing ADT 10.0. I am wondering if it somehow is building R.java as a read-only file.

EDIT: Is deleting the eclipse directory sufficient to reset all of its configuration?

More info: All my projects are fine, until I rebuild or clean them. Then every class that looks at R.java throws an error.


Solution

  • I have somehow managed to fix it, but I don't know exactly what did it. Here are things I did.

    • Deleted eclipse directory and reinstalled it and ADT.
    • Deleted my original project that was the first to have the problem.'
    • Created a new project with my original's project name.
    • Manually copied all my class and res files into the new project and refreshed it.
    • Pasted the text of the old manifest into the new manifest.

    I did all this, because simply importing the original project again didn't solve anything.

    After the above changes, my other projects still had the problem after pressing clean on them. But then I could fix those by deleting the Gen folder, and making sure the Java Build Path had all folders checked.