3

When I create a new android project in Eclipse, and I choose to have a default main activity, my R.java file does not get generated.

I have seen some questions online and on this site about R.java not being generated but all are due to some manual action/mistake that had to be corrected during the development of the application.

However, does anyone know why R.java would not get generated for a brand new android project, where I have made no manual modifications whatsoever?

bstack
  • 2,466
  • 3
  • 25
  • 38
  • 1
    if you have updated adt to rev 22. goto android sdk manager and check if android sdk tools is installed if not install the same. clean and build the project. R.java will also be not generated if you have errors in your resource files. So cross check again – Raghunandan May 28 '13 at 07:33
  • Clean your project and Re-build. – Jibran Khan May 28 '13 at 07:33
  • is any work? reply to some ones... – Sanket Kachhela May 28 '13 at 07:43
  • http://stackoverflow.com/questions/2757107/developing-for-android-in-eclipse-r-java-not-generating?rq=1 Does this help? – Emperor Orionii May 28 '13 at 07:43
  • Thanks Raghunandan - That worked, SDK tools not installed – bstack May 28 '13 at 09:27
  • 1
    have you update SDK Tools rev to **22**? if yes then check update for **ADT plugins**. and install also **buid-tools**. and than restart eclipse.. may it work. OR refer [this](http://stackoverflow.com/questions/16585528/android-adt-version-22-r-java-files-not-generated) – Sanket Kachhela May 28 '13 at 07:39
  • @SanketKachhela: This didn't help me, my R.java not generating for any project - existing or new ones. – Narendra Singh Nov 18 '14 at 13:44

4 Answers4

3

I think your problem is just the latest update of the SDK.

Test the following operations on two projects :

  • In the project properties (eclipse) -> java build path -> order and export make sure that all your jars in the libs folder are checked.
  • And "Android Tools -> Fix Project Properties"
  • And "Project -> Clean"

I hope you have helped!

lopez.mikhael
  • 9,943
  • 19
  • 67
  • 110
  • This is kindof right. The issue was I had not installed the SDK tools and I did what Raghunandan suggested above. Thanks for the help – bstack May 28 '13 at 09:28
1

ADT version 22 requires that you install "build tools". To get it to work i had to update:

  • SDK Tools
  • Platform Tools

Then install:

  • Build Tools

This link recommends you add build tools to your environment path. I had to do the following before the R.java was generated:

  1. Append build tools to PATH environment variable
  2. Restart Eclipse.
Community
  • 1
  • 1
TrueCoke
  • 2,406
  • 1
  • 16
  • 9
0

Make sure your project is free of errors and problems. You can use Windows-View to find and rectify them. Common mistakes are in the layout files. Check the AndroidManifest file and see if the activity names match the classes in your source folder. Clean and rebuild.

Rohit
  • 11
  • 1
0

R.java creates every time when you create android project first time r.java created by default

so check for the errors and clean the project.

anddevmanu
  • 1,459
  • 14
  • 19
  • I know this, the issue was it was not generating the R.java file as soon as the project was created. The issue was resolved once I installed SDK tools. Thanks for the help – bstack May 28 '13 at 09:30