Eclipse doesn't generate R.java and gen folder

15,214

Solution 1

Checking the SDK Manager worked for me. It seems Android Build Tools went missing :/
Strange behaviour from eclipse...

enter image description here

After installing it everything worked as expected. So here's another solution...

Hope it works for you,
Take care.

Solution 2

I spent on this about an hour... In my case it was because of a file in drawables containing -.

Eclipse can't mark your files with wrong characters.

check your drawable folders and files in them. Also you can check another folders with resources or something like that. This problem can be caused by wrong (unsupported) characters in some file names.

Share:
15,214
GuilhE
Author by

GuilhE

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” - Brian W. Kernighan

Updated on June 05, 2022

Comments

  • GuilhE
    GuilhE about 2 years

    I had to share this problem with you 'cause I lost an entirely morning around this. So what was my problem? Suddenly Eclipse refuses to generate R.java and create gen folder. I've tried all kind of solutions I came across in stackoverflow and some blogs:

    • Clean Project and Rebuild
    • Clean Project with Build Automatically off and then Rebuild
    • Create the gen folder
    • Create gen folder with a R.java dummy
    • Copy the gen folder from that project used in another project (different workspaces)
    • Validate all my .xml files

    Nothing worked... So, what was the solution? I'll answer myself.

  • GuilhE
    GuilhE about 11 years
    All my files were ok, build-tools went missing without reason :/
  • Steve Benett
    Steve Benett about 11 years
    Had the exact same problem today.. Updated Android SDK and Eclipse and the Build Tools disappered.
  • GuilhE
    GuilhE about 11 years
    After this update my Eclipse went nuts. Projects that were working just fine now throw Dex Loader, Dalvik and java.lang.NoClassDefFoundError errors. Nice Google, going to reinstall ADT and all this crap again...
  • Steve Benett
    Steve Benett about 11 years
    You have to import the SupportLibrary for any project with these errors.
  • GuilhE
    GuilhE about 11 years
    Well remembered I had forgotten to update the android-support-v4.jar, but the "Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/google/common/base/Function;" is still here
  • GuilhE
    GuilhE about 11 years
    Installed Android ADT Bundle (Eclipse) everything is working now
  • r41n
    r41n about 10 years
    Something similar here, had an error in one of my menu.xml files, but eclipse didn't bother to flag it as error