When I am creating a new android project in eclipse a file named R.java is supposed to be created automatically which is not happening.

My Ubuntu is 12.04 LTS 64 bit
My Eclipse version is juno for jee SR1 x86_64


This is a common Eclipse ADT problem, yet there's not a concrete answer to solve this, there are different ways to aproach this like the following:

1: Clean the project

Project ---> Clean

-according to the Eclipse ADT plugin developers and contributors:

if you run a clean on the project it should regenerate all the generated java files, namely R.

you should never import android.R (if you do this, you will find out that this file is shared between all the projects on eclipse, so if you delete or remove the project who has this file in the first place, you will corrupt all the other projects you import the file with).

I've tried this with no results, but you should try all the possible solutions

2: Removing corrupted files

this source has helped me before, you should give it a try

3: Using a different IDE to develop Android apps

I find AndroidStudio a very good tool to develop even though its in beta release, i never have to solve the R.java problem because Graddle (a build automation tool) let me know or even solve all the corrupted files that might have my android app

You can download it in here

works in Windows,Mac and Linux and you can even migrate your Eclipse projects to AndroidStudio to continue to work in your android apps

  • But AndroidStudio always fetch gradle info, while importing or creating new app, that process is much time consuming. Any solution for that? – Narendra Singh Nov 18 '14 at 12:30
  • make sure that you workspace is in your home_dir /home/[uName]/ (or any sub_dir)
  • make sure that there aren't any errors in any resource file

    • the R.java will not be created if there are any errors.
  • make sure that android:targetSdkVersion="xx" in the AndroidManifest.xml is typically the android version you had installed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.