After upgrading to Android ADT version 22 and cleaning my project, the R.java files went missing. I can’t use setViewContent(R.layout.activity_main) because the activity cannot reference to the xml layout (due to the missing R.java). Also, when using the (ctrl + space) to get suggestions for setContentView, the code is not typed in. Upon looking at the error log, it shows that there was an “Unhandled event loop exception”. The plug-in involved is the org.eclipse.ui.
Also, whenever I create a new Hello World project, the gen folder is empty.
After a few hours, I tried the android studio. But I didn’t like it there. Then, when I went back to Eclipse, there was an update for SDK platform tools and build tools. I updated them but I still get the errors.
I tried cleaning the project but no luck. What seems to be the problem?
I had the same problem just solved it.
Update Android SDK Tools and Android SDK Platform-tools and Android SDK Build-tools from Android SDK Manager
Add abover dir to your ENV $PATH
Not enough credits (yet 🙂 ) to vote up or comment directly on Rany A. Ishak’s answer, but after one day lost trying to fix these silly problems, I’m very confident I’ve found the right solution…I’m installing Android SDK Build-tools right now, I’ll get back soon on this!
The solution for this is, open “Android SDK Manager”. Download “Android SDK build tools”. Then for safety, restart your eclipse. That’s it. Back to normal. All apps start building.
Android SDK now has a special package: Build Tools. It was not present in earlier SDK versions, and seems like it MUST be installed in order to generate those R files. It is now the one package that does that stuff. (And probably everything else regarding building for Android). So, if you not have that installed (and you will likely not have if you just upgraded the SDK), it’s like missing a compiler – you can’t ever expect your code to be compiled if there is no compiler.
I had the same exact problem after updating to SDK 22. There seems to be an issue in the Android SDK update process that the process needed to run twice to update the SDK Tools completely. Make sure you check the SDK manager a few times by closing and re-opening the SDK manager (not Eclipse) to load the new updates. Then restart eclipse and check the SDK manager again. Make sure all items are updated. Then clean your projects and R.java will get created again.
In Eclipse, go to Project menu,there is an option build automatically, click it. That would help you build the R.java file everytime modifications are made in your project. The Clean option is also there under Project. It will help you.
I tried the following. Let the application name be “My First Application”. Then the name of the package should be com.xx.myfirstapplication.yy. Make sure that you add a yy after the application name in the package field while creating the application. Hope it helps.
The Same problem happened to me also,
1.Check that Android SDK Build-tools is installed. Window->Android SDK Manager->Tools->Android SDK Build-tools
2.Make sure when you update the Android SDK Tools, you also update the Android SDK Platform-tools and Android ASK Build-tools. Build fails silently if they don’t match.
1.Update Android SDK Tools and Android SDK Platform-tools and Android SDK Build-tools from Android SDK Manager (Window->Android SDK Manager->Tools->Android SDK Build-tools).Then restart the eclipse.
This is…. “Much ado about nothing”!!!
In my case there is error due to “&” inside strings.xml file(but error not shown) for declaring string for a array type. Now the problem has been solved as I changed “&” to “and”.
So, please make sure that you do not have such silly use of symbols, and clean the project.
I had the same problem,
I just removed all the errors in my source files and xml files then R.java was generated.