Ted pottel
Ted pottel

Reputation: 6983

Eclipse The R class is not being built for my android projects

My system crashed and I had to re-install all my software. Now only like,..... half my android projects will build. It seems like the R class is not being built. I had this issue before, but it seemed to vanish some how.

I'm using eclipse.

I tried everything, building the project, cleaning it, then building it, nothing seems to work!

error setContentView(R.layout.factlist); R cannot be resolved to a verable

Upvotes: 1

Views: 1462

Answers (3)

Amokrane Chentir
Amokrane Chentir

Reputation: 30385

It happens to me too, very often. In general when R.javadisappears that means that there is an error somewhere in your project (which prevents this file to be generated).

Verify carefully, if everything is Ok especially in your resources files (XML files). Eclipse can help you determining what is wrong in the Problems window.

Upvotes: 3

MAC
MAC

Reputation: 15847

R.java will automatically created.

First of all you solve other errors of your project which are not related to R.java.

When you will solve all other errors your R.java will created automatically.

If you are still not able to remove errors.

Just comment the code which has errors other then R.java

Then one by one remove comments and resolve your errors.

Hope this will help you...

Upvotes: 2

wdziemia
wdziemia

Reputation: 1459

There are two main reasons for this. Either your import statement for importing R or there is an error in an XML file. At the top if your class, make sure your doing the following:

import your.pacakge.R; //make sure its not import android.R;

If that doesn't work, check the XML file you're working. Make sure it has no errors (open tags, misspelled tags, etc..)

Upvotes: 3

Related Questions