0

I'm starting to program android Apps with eclipse. At the start all is Ok but after a week in all projects the file R.java was taked off and all projects not work. I search for mthods to regen it also here but any method that i try not work (clean, build automatically, Right click>preferences>java build path). Nothing work and i don't know how to solve (i also reinstall sdk and eclipse, only sdk....) The space in the local disc is sufficient to take all datas. How can i solve? Thanks you!

http://imageshack.com/a/img537/1047/Ngegx7.jpg

Mattia
  • 199
  • 1
  • 1
  • 12
  • Create a new project and transfer your files there. – Azae B. Garcia Dec 08 '14 at 15:31
  • Also if i create a new project, it starts without R.java class.... – Mattia Dec 08 '14 at 16:39
  • There is probably an error with your Eclipse environment, have you tried restarting eclipse? – Azae B. Garcia Dec 08 '14 at 17:20
  • I also tried to reinstall eclipse and sdk...not only restart...:D – Mattia Dec 08 '14 at 17:24
  • Can you post a screenshot of your folder's tree? The one on the package explorer section – Azae B. Garcia Dec 08 '14 at 17:28
  • Yeah sure...i post it in the principale answer (watch up) – Mattia Dec 08 '14 at 17:35
  • See here, to see if that method works http://stackoverflow.com/a/22758404/4324834 the error might also be coming from the other projects in your workspace so to make sure that everything is ok start with a new project and no other projects in the same workspace. – Azae B. Garcia Dec 08 '14 at 17:45
  • I try...i also have open only one project (the others are close) but nothing...the file R.java not regen and it contineu to giv eme the error – Mattia Dec 08 '14 at 18:08
  • You mentioned that Build Automatically is enabled right? – Azae B. Garcia Dec 08 '14 at 18:16
  • Now no..in a guide i find it and i try also to uncheck and to retry...but nothing – Mattia Dec 08 '14 at 18:22
  • If you want to send me your project I can probably take a look – Azae B. Garcia Dec 08 '14 at 18:31
  • the problem is that all projects that i create or import have that problem... – Mattia Dec 08 '14 at 18:37
  • There are so many possible answers, error in xml file, a library is missing in the project, drawable images are named in an unsupported format (my_drawable.png instead of my-drawable.png)m It's very hard to know what the problem might be, hit the panic button. Restart your computer, open eclipse, remove all your projects, change workspace, etc.. start from zero which I know you probably already did. – Azae B. Garcia Dec 08 '14 at 18:48
  • try to create a project that uses a newer API, like 19 and above and don't use the supporting library – Azae B. Garcia Dec 08 '14 at 18:50
  • for those projects i use only API 19...for all :D – Mattia Dec 08 '14 at 19:06
  • i don't know how to solve..i can't restore the Operative System.... – Mattia Dec 08 '14 at 22:22
  • Wow, It seems more complicated than normal, you might consider a switch to https://developer.android.com/sdk/index.html – Azae B. Garcia Dec 09 '14 at 13:53
  • i will try....the projects in Android Studio have the same structure then eclipse and i can import them normally? – Mattia Dec 09 '14 at 16:22
  • Android Studio is a whole new interface which can be sometimes confusing and cause headaches but once you get the hang of it you'll see how amazing it is, specially now that is not on BETA anymore so you can start fresh developing on a stable environment. Please read this which will help you migrate properly from eclipse to AS https://developer.android.com/sdk/installing/migrate.html – Azae B. Garcia Dec 09 '14 at 17:08

1 Answers1

1

R files are automatically generated when project is built (like how you are doing clean - build). However, a common reason for R being not generated is when there is some error in your layout xml or etc. after cleaning (removing all generated stuff) the project.

Try to check the last place you edited and see if there is no error.

Another Dev
  • 116
  • 1
  • 7
  • I haven't errors...the unique error that i have is the R class that isn't found. And the R file is taked off also in projects that the days before were working. I didn't modify them and one day the R class was disappear. An other projects that i create start without the R class and i can't do anything (when i create a new project i start without the R – Mattia Dec 08 '14 at 15:59
  • Try double checking all your XML files and check that at the top it says . Also triple check that they are all spelt right. That was what my problem was – Chrome Penguin Studios Dec 08 '14 at 18:00