1

Okay, I have spent several hours researching the issue with R not being resolved to a variable in eclipse for Android and still have not solved it. Here is what I have tried:

  1. No errors are appearing in any of my resources xml files.
  2. all xml files and image names are lower case.
  3. The java build path has Android 4.2.2 checked.
  4. None of the java files have "Import R".
  5. I have cleaned the project.
  6. Build Project is set to automatic...though I have tried building manually as well.
  7. Closed and re-opened eclipse.

I see by all my research that this is a common problem, but I cannot find the solution that works for me. Any idea's of what else I can try would be appreciated.

2
  • updated adt to rev 22? Commented Jun 25, 2013 at 16:27
  • yep, I'm running adt 22. Commented Jun 25, 2013 at 18:04

4 Answers 4

2

Most likely you got error in one of your xml files in res/ folder. it sometimes may not show up on Package Explorer tree as file with red error marker, but you may open Window -> Show View -> Problems view and investigate there, as whatever is causing R generation to fail, will be listed there.

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

4 Comments

The only errors that show up by clicking window > show view > problems are the R cannot be resolved to a variable. At the top of this view it says "213 errors, 0 warnings, 0 others (Filter matched 100 of 213 items)". Does this mean I am only seeing the first 100 of 213 errors?
@user2284316 what's your adt version? is it rev 22?
Yes. You got paging endabled. You can select these 100 (by clicking with SHIFT and then delete) to unvelil remaing ones, or disable paging by pressing "down arrow" (it's on right top area) then "Configure Contents" and then untick "Use item limits"
This didn't appear to be the issue, so I created a new android project and it has the same issue with the R variable as well.
0

Errors in your XML file doesn't appear always. Check your all code line by line and try to find error. Also try Lint to see if there is any error or problem causing that.

For the Lint, right click on your project, go to Android Tools and click on Run Lint : Check for Common Errors

2 Comments

This didn't appear to be the issue, so I created a new android project and it has the same issue with the R variable as well.
Currently, in the new project, the only xml file is the hello world file that is auto-generated when you create a new project.
0

Delete you project from eclipse. Don't delete it from disk otherwise you lost it.Then make new project with existing android project.Clean your project then your problem might get resolved.

1 Comment

Nada...new project has the same issue...cannot resolve R variable.
0

Make sure you have Android SDK Build-Tools installed from the Android SDK Manager.

It's the third item down.

See here for pictures.

1 Comment

Ah well, that was my first guess. Bonus "off the wall" guess - make sure your directory doesn't have any permissions issues and everything is writable by everyone. Alternatively launch Eclipse with admin privileges.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.