0

Good morning.

I am creating a "Android Application Project" and I get an error "R can not be resolved to a variable". The error I get nothing and create the blueprint (the "Hello World") without adding any thing more (the basic example).

Thank you.

PS: Platform SDK: API 17; Android SDK Tools: 22.0.1, Build-Android SDK Tools: 17.

Sebosin
  • 167
  • 6
  • 16
  • try this http://stackoverflow.com/questions/17440595/r-cannot-be-resolved-may-have-wrong-build-path-or-libraries-import/17440632#17440632 – Sunil Kumar Jul 04 '13 at 08:58
  • check if you have installed android sdk build tools from android sdk manager. – Raghunandan Jul 04 '13 at 08:58
  • possible duplicate of [Eclipse giving error, missing R.java file after recent update](http://stackoverflow.com/questions/16608524/eclipse-giving-error-missing-r-java-file-after-recent-update) – g00dy Jul 04 '13 at 08:59

2 Answers2

3

As stated here:

After updating to SDK Tools to rev. 22 for the first time, you may need to relaunch Android SDK Manager again and install a new item: Android SDK Build-tools. enter image description here

After installing this, clean your projects and rebuild.

Community
  • 1
  • 1
g00dy
  • 6,752
  • 2
  • 30
  • 43
  • Thanks! Uninstalled this due to an upgrade, and got this error. *NO* indication what the IDE is failing at. – simendsjo Oct 22 '14 at 20:20
2

'R' isn't generated if there are any errors in your XML files. So check all your XML files. Check for errors in naming the XML files. No capital letters etc.

If you're using Eclipse, it helps if you delete your gen folder and add it using Project > Properties > Java Build Path > Source tab > Add Source > Select gen and then Clean and Build your project

Traxex1909
  • 2,650
  • 4
  • 20
  • 25