tags:

views:

6873

answers:

12

Did a fresh install of Eclipse, JDK and android-sdk.

I am currently receiving this error when creating a new project

[2010-09-26 16:07:56 - Test] ERROR: Unable to open class file C:\workspace\Test\gen\com\example\test\R.java: No such file or directory

What's the reason for this and how I fix it?

Eclipse Helios 32 bit java version "1.6.0_21" Android sdk API 8

P.S. Im new to Android development.

EDIT: I tried most of you solutions, but nothing worked. So I started using my frineds install of Eclipse Ganymeade.

+4  A: 

Have a look at your console. It is an aapt aborted error. Since aapt is the tool that auto-generates R.java, therefore, R.java was not getting generated.

Since R.java is a auto-generated file that stores information about your drawables you should rebuild your project. Before that have a look at your layout xml files and check them for errors.

Notice that Project -> Build All should be selected. Also try to run your project.

ArtWorkAD
+1  A: 

Had a almost identical issue with Eclipse Helios 64 bit on Linux, but I had the "1.6.0" API selected like you. The bizarre thing was I could type;

cat <the path it was moaning about>

in a console it would display correctly.

I created a new AVD which used Android 2.1, the issue magically vanished. Perhaps it's a bug in Android SDK or Eclipse?

Chris Huang-Leaver
+4  A: 

I have had same issue, all what I needed to do, was create project and restart eclipse.

//Edit: Complete collapsing of "Package" tree works as well.

Ency
I think that's the same thing I discovered, I like your way better :-)
Chris Huang-Leaver
Silly how this worked.
Rafael Belliard
A: 

I had a similar error on the creation of new projects myself. After messing around I tried moving the R.Java file into the same location as my projects java file (the src file). Eclipse then saw I removed the R.Java file from its location and created another and that seemed to clean up the error.....I dont know if it was because eclipse rebuilt the file and then saw it or what but that seemed to work for now.

big jim
A: 

I just did the same thing I posted before and it works, especially for some one like myself that is more of a designer than programmer. If you start a project and you get that R.java error at the start, just move it to another file and eclipse will auto reconfigure a new one for you. This will work as you work through your project. Im sure its because of some setting I clicked on and off but I cant seem to find it. Ive tried to use build automatically and things like that but nothing works yet except moving the file to a new location and letting eclipse rebuild it for you

big jim
A: 

I would say that once you have created your project and you've mention the R.class error --> just restart the Eclipse IDE and everything will be fine ;)

ivoo
A: 

Right click on your project name in package explorer. Then click 'Validate'. It will be fine.

guldari
A: 

1.-Open Eclipse 2.-Open Window/Preference 3.-Expand JAVA option 4.-Select Build Path 5.-Check the option "Projec"t and uncheck "folder" options 6.-Click on OK 7.-Restart eclipse IDE

Let's go to code !!

Orlando Herrera
A: 

Here is how to fix it: Go to your "workspace" folder and make sure it's not "read-only"

Brennan McEachran
A: 

Restarting eclipse worked for me eclipse 3.5 ubuntu 10.10

Dilantha