BIOS,Windows, Linux, Software,Security, Domains, Web Hosting

R cannot be resolved to a variable

There are many possible reason that you will get "R cannot be resolved to a variable" in eclipse. This post I will list some of them that I have met.

1. Your package has been changed, but not complete

Check these position:

Make sure your package name in AndroidManifest.xml, *.java header, must be the same. the name is case sensitive. If the package is not inconsistent each other, you will get "R cannot be resolved to a variable" even if you clear all the project temporary data (Project > Clean).

2. There are some errors with your res directory

Eclipse will not generate R.java if you has something wrong with res files, especially *.xml files. Just open your res and check it again. 

Moveover make sure your .xml files are not broken. strings.xml must be checked.

3. Eclipse doe not work again 

Project > Clean for your project, and reopen eclipse

4. No permission with your working directory

If you are using linux (eg, ubuntu), make sure you have permision to run/debug the current project.

Related Articles

Comments(0)  

Leave a Reply

Subscribe to BootBeta Comments RSS feed to receive notification of latest comments posted.

Subscriptions

  • Enter Email Address:

Recent Post

Copyright@ 2010-2014 Bootbeta All Rights Reserved.
HooBlog Ver 1.5 Build 20140530