Nistor Alexandru
Nistor Alexandru

Reputation: 5393

how to fix errors in generated code

Hi! Recently I started to learn Android development, and while making a project from a book,I got into a problem in running the project code. I had to do a photo gallery. All went well, but when I try to run it, I get an error in R.java class automatically generated by Eclipse. After class R has been generated I found that at the end of the class a brace is missing. I tried to edit the code but Eclipse won't let me. I created another project and I got the source code from the book and the same error appeared in class R (the last brace was not generated). How can I solve this problem?

Upvotes: 1

Views: 742

Answers (2)

Lo Juego
Lo Juego

Reputation: 1325

Try this:

1.- Import the project into eclipse (File -> Import -> General -> Existing Projects into Workspace)

2.- In Eclipse, Manually create gen folder and add it as source folder (right click on the project: Build Path -> Configure Build Path -> Add folder)

3.- Clean the project, you suppose to get R.java well generated

Upvotes: 1

Kumar Vivek Mitra
Kumar Vivek Mitra

Reputation: 33544

Try these.....

- Delete the R.java file, then clean the project.

- See, is there any error in your .xml file, which are used to define your layouts.

- Don't do any manual changes to the R.java file, its an auto-generated file which contains the constants, grouped according to their xml resource type.

Upvotes: 1

Related Questions