0

R.java file disappears while importing image and sound files to the raw and layout folders in resource in eclipse. How to fix the bug and bring back the missing R.java file?

0

4 Answers 4

1

R.java is automatically generated at build time. If it isn't there, there's probably an issue with the XML in one of your layouts that's stopping the build.

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

Comments

1

Cleaning your project (Project -> Clean...) will bring back the R.java file if there is no error (maximum time problem is in XML files). If problem still persists restart Eclipse.

Comments

0

R.Java is an autogenerated file. It is supposed to come back when you run you project if you haven't created any errors.

Comments

0

It can be several problems, from my personal experience I suggest the following:

  • Check for errors in all files when attempting a build (I know this is basic, but I have to mention it anyway)
  • Check for errors in layouts
  • Check for errors in file names (like '@' or other incompatible characters for file/resources names).
  • Don't do 'import android.R.java' anywhere
  • Check the Android properties of the project on Eclipse, and see that both the properties and the Manifest have the same version target.
  • On the manifest, check that the package name is correct (it can happen if you are copying/pasting code from another project, that you forget to correct this on the manifest, and it will just mark a general error on the project but not specifically on the Manifest.xml)

After all that, do Project->Clean, then Build.

PS.: Another thing I suggest is unchecking the automatic build option.

Comments

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.