1

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?

4
  • Try to simply delete R.java in your filesystem and run the application. Commented Oct 10, 2012 at 11:11
  • Errors in R is a very common issue. You should never edit it though. Search around for possible solutions. The first thing I'd try is to clean the project. Commented Oct 10, 2012 at 11:11
  • errors like this are usually related to the layout configurations, check your xml files. Commented Oct 10, 2012 at 11:14
  • clean and build your project. Commented Oct 10, 2012 at 11:14

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

1

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.

2 Comments

I tryed deleting the R.Java file and when I ran the project it regeneratd it with the same error , I've rewritten the xml code but nwo it says that it can not find the photo gallery
@did you clean the project after deleting it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.