5

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
  • 11,591
  • 16
  • 75
  • 116
  • Have you updated the Android SDK tool recently ? – Stephane Mathis May 27 '13 at 13:23
  • Yes I did an update but this behaviour is the first time it happens. All my past updates didn't cause this strange behaviour, that's why I didn't remember to check SDK Tools – GuilhE May 27 '13 at 13:35
  • Possible duplicates: http://stackoverflow.com/search?q=%2Beclipse+%2Br.java+%2B+generate – Kai May 27 '13 at 13:48

2 Answers2

16

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.

GuilhE
  • 11,591
  • 16
  • 75
  • 116
  • 1
    Had the exact same problem today.. Updated Android SDK and Eclipse and the Build Tools disappered. – Steve Benett May 27 '13 at 14:04
  • 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... – GuilhE May 27 '13 at 14:13
  • 1
    You have to import the SupportLibrary for any project with these errors. – Steve Benett May 27 '13 at 14:26
  • 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 May 27 '13 at 14:37
  • Installed Android ADT Bundle (Eclipse) everything is working now – GuilhE May 28 '13 at 08:56
3

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.

shift66
  • 11,760
  • 13
  • 50
  • 83
  • All my files were ok, build-tools went missing without reason :/ – GuilhE May 27 '13 at 13:37
  • Something similar here, had an error in one of my menu.xml files, but eclipse didn't bother to flag it as error – r41n May 29 '14 at 09:53