14

This happens for a new project too!

The gen folder is empty. No errors in activity_main.xml file.

I have tried:

  • Project->Clean
  • Project->Properties-> check android version
  • Project->Build
  • Re installing eclipse (latest)
  • Re installing ADT plugin (latest)
  • commenting lines: setContentView(R.layout.activity_main); and getMenuInflater().inflate(R.menu.main, menu); and building project

but still the gen folder is empty! help!

5
  • do you have errors inside res/ folder? Commented May 17, 2013 at 18:17
  • 2
    stackoverflow.com/questions/16611223/… Commented May 17, 2013 at 18:20
  • Carefully check the Problems window. Often there is an error in a resource XML file that is not marked appropriate. Commented May 17, 2013 at 18:20
  • Have you recently changed your package name? Commented May 17, 2013 at 19:36
  • stackoverflow.com/questions/16608524/… Commented May 31, 2013 at 19:17

4 Answers 4

21

This solved my problem: Eclipse giving error, missing R.java file after recent update

It was the latest ADT update. After the update we need to install android sdk build-tools.

Sign up to request clarification or add additional context in comments.

Comments

4

I assume you have updated ADT with version 22 and R.java file is not getting generated.

If this is the case, then here is the solution:

Hope you know Android studio has gradle building tool. Same as in eclipse they have given new component in the Tools folder called Android SDK Build-tools that needs to be installed. Open the Android SDK Manager, select the newly added build tools, install it, restart the SDK Manager after the update. Got this answer from this link. Eclipse error: R cannot be resolved to a variable

It's working for me now

Comments

2

The solution is to restart the SDK Manager after updating the SDK tools to version 22. Only then the newest version of the Android build tools appears and can be installed. This fixed the error for me.

Comments

1

I had the same problem.

I solved it this way:

  • In the project properties (eclipse) -> java build path -> order and export make sure that all your jars in the libs folder are checked.
  • And "Android Tools -> Fix Project Properties" then "Project -> Clean"
  • Be careful not to forget to put in: "Project -> Build Automatically"

This is a problem with the updates of Android SDK (tools version 22, platform tools version 17).

5 Comments

They are all checked. The problem persists.
I suggest you remove your project and import again while trying to restart eclipse.
If you use another library project you must also do what I wrote for this project.
Check your layouts files.many a times when there is an error in your layout file is when R is not recognized. Check all closing tags.
Thanks! This solved the issue on R cannot be resolved

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.