Now you can Subscribe using RSS

Submit your Email

Sunday

Where is my R.java file?

Vishal Shrestha
Why is it deleted?

This usually happens when there are errors in your XML files.



  • Check errors inside your XML files, Remember not to use any capital cases while naming Resources. This was the problem in my case.
  • Other common places are /layout/ and /values/ especially if you've changed one of them recently.
  • You might have changed a string, and forget to change the string name from AndroidManifest.xml.
  • Your android SDK tools and SDK Platform-tool and Build tools might not match
Solutions.
  • Fix all errors in your XML files and Build again. Remember - Resource and file names must be in small case.
  • If you had somehow imported android.R in your activity, remove it.
  • Run Project -> Clean. This will delete and regenerate R and BuildConfig.
  • Make sure Project -> Build Automatically is ticked. If not, build it manually via Menu -> Project -> Build Project .
  • If it still doesn't work, try right-clicking your project -> Android Tools -> Fix Project Properties.
  • Check your *.properties files (in the root folder of your app folder) and make sure that the links in there are not broken.
  • The build target should match the target in AndroidManifest.xml.
  • If you are sure everything else is right, you can try to copy the R.java file of another project and clean you project.

Vishal Shrestha / Author & Founder

A developer by profession, a born Adventurer. I mainly do Android but like to get my hands dirty with web development and a little bit of Python. I would't rather go on a Trek than a party and you can find me having a few rounds with the heavy bag to let out the steam ;)

For Business info : My Portfolio Site.

0 comments:

Post a Comment

Coprights @ 2017 | The Code City by Vishal Shrestha Vishal Shrestha