Aksiom
Aksiom

Reputation: 1585

"R cannot be resolved to a variable" error

I think these posts are the best here on stackoverflow that are related to my issue:

“R cannot be resolved to a variable”?

R cannot be resolved - Android error

I tried every answer on those posts, but I still didnt fix my "R cannot be resolved to a variable" error. I'm really desperate at this point. The interesting part is that I had yesterday the same problem and I fixed it with the clean project + restart IDE method, but today it's not working. I never had this problem until I updated my ADT to ADT 21.1.0. I know that my res files are not allowed to have any errors, but they have some warnings. Are those warnings coausing the problem?

Upvotes: 1

Views: 437

Answers (2)

misba
misba

Reputation: 1

Sometimes it will happen when memory cache not cleared previous data . Just simply clear your project then it will worked .

procedure : In eclipse go project then you will see clear ...

then press clear and select your project and press ok . hope it will work. best of luck

Upvotes: 0

melvynkim
melvynkim

Reputation: 1655

R.java is deleted whenever there exists any compile error in res/ folder or in AndroidManifest.xml file. You have to check every files in res/ folder and AndroidManifest.xml to fix the problem.

Upvotes: 4

Related Questions