user1868185
user1868185

Reputation: 899

Android development with Eclipse clean and build

Hi can anybody help me with the Eclipse SDK. I have cleaned my Android project then suddenly all of my Java class is in red and I can't build it, all of the references like the the R has a red mark in it and before I cleaned it, the R was in blue. It always does this when I clean the project and sometimes build it.

     setContentView(R.layout.id);

I tried to delete the gen folder then clean it again with the auto build uncheck then build it again then clean it again.

I also tried closing the Eclipse SDK and then opening and cleaning it again but to no avail.

I tried everything with this one can anybody help me? and thanks! Also can anybody recommend a good SDK for making android projects because Eclipse really sucks and thanks again!

Upvotes: 0

Views: 152

Answers (4)

hRb
hRb

Reputation: 61

delete the imported R file and try again..

Upvotes: 0

whitfin
whitfin

Reputation: 4629

When you clean, you'll get errors on everything referencing R as it doesn't exist. It needs to be rebuilt by Eclipse (in the Project meun, there should be an option for "Build Automatically"). Just give it a couple of minutes after cleaning and it should resolve itself.

(You can follow the progress in the bottom right corner of Eclipse "Building workspace...")

Upvotes: 0

Prakhar
Prakhar

Reputation: 2310

Hey add this in your imports and check if it works...

import yourPackage.R;

Update :

1) Go to your sdk manager.

2) If there is a build tools update or install then please update or install it.

3) Restart the eclipse..

4) Enjoy.........

Upvotes: 0

alvi
alvi

Reputation: 2702

If everything was fine before the clean, then the errors may happen because the generated classes (R, that is) has not yet been generated but eclipse already started to validate your classes.

You probably need to refresh after a little bit, or, if you set eclipse to auto-build sources, just wait a bit longer. Repeated 'refresh' (F5) often help also in this case.

As for alternative IDE: You could try android studio or the intellij IDEA community edition.

Upvotes: 2

Related Questions