Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

test: Reply
 
LinkBack Thread Tools
Old July 28th, 2011, 02:11 AM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Jul 2011
Posts: 5
 
Device(s):
Carrier: Not Provided

Thanks: 1
Thanked 0 Times in 0 Posts
Default R cannot be resolved to a variable

My DroidAvtivity.Java file started with this error..."R cannot be resolved to a variable"...if you could please tell me what happened to my file?

Advertisements
aliblu is offline  
Reply With Quote
sponsored links
Old July 28th, 2011, 02:24 AM   #2 (permalink)
Junior Member
 
Join Date: Jul 2011
Location: Moscow
Posts: 27
 
Device(s): HTC WildFire
Carrier: Not Provided

Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via ICQ to dimiter
Default

Try Project->Clean. Also sure, what variable is declarated (ex. , if it's view id, check existence this id in xml)

If project get start, and error go down the drain, it's eclipse feature.
dimiter is offline  
Reply With Quote
The Following User Says Thank You to dimiter For This Useful Post:
alostpacket (July 28th, 2011)
Old July 28th, 2011, 02:29 AM   #3 (permalink)
New Member
Thread Author (OP)
 
Join Date: Jul 2011
Posts: 5
 
Device(s):
Carrier: Not Provided

Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thank you brah
aliblu is offline  
Reply With Quote
Old July 28th, 2011, 03:59 AM   #4 (permalink)
Over Macho Grande?
 
alostpacket's Avatar
 
Join Date: Nov 2009
Location: NY
Posts: 7,920
 
Device(s): GlassXE, MotoX, N5, N4, N7'12, GNex, N1, SGT10.1, Revue, Xoom, Eris, OG Droid
Carrier: TMO

Thanks: 4,603
Thanked 3,579 Times in 1,530 Posts
Default

yep

Project > clean is like the ultimate first line of defense in all things weird with eclipse.
alostpacket is offline  
Reply With Quote
Old August 2nd, 2011, 02:18 PM   #5 (permalink)
New Member
Thread Author (OP)
 
Join Date: Jul 2011
Posts: 5
 
Device(s):
Carrier: Not Provided

Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hmmm so Project > Clean does not seem to be holding up... Any other suggestions?
aliblu is offline  
Reply With Quote
Old January 6th, 2012, 09:50 PM   #6 (permalink)
New Member
 
Join Date: Jan 2012
Posts: 2
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have tried Project > Clean numerous times and it still has not resolved the issue. Other sites have said to reinstall the .android folder, remove the import R line, change the target of the run/debug for the project, turn automatic rebuild off, delete and recreate all AVDs, etc. but nothing has worked. Any ideas?
danBuonocore is offline  
Reply With Quote
Old February 6th, 2013, 10:57 PM   #7 (permalink)
New Member
 
Join Date: Dec 2012
Posts: 3
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default Re [R cannot be resolved to a variable]

I hate this error, I have also had success with right click on project > android tools > fix project properties, but that is not work for me now. ahhhhh. I can't rebuild because my project has errors everywhere where I use R...
israfelwater is offline  
Reply With Quote
Old February 6th, 2013, 11:05 PM   #8 (permalink)
New Member
 
Join Date: Dec 2012
Posts: 3
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

oh, nevermind, All I had to do was delete the line in the xml file which was throwing an error, save, and turn on automatic builds. Then the error went away and "/res" built properly under the "gen" dir.

Odd, I commented out the line but the error wouldn't go away. I had to delete it...

here is a helpful link for this error

eclipse - R cannot be resolved - Android error - Stack Overflow
israfelwater is offline  
Last edited by israfelwater; February 6th, 2013 at 11:08 PM.
Reply With Quote
Old February 7th, 2013, 08:38 AM   #9 (permalink)
Senior Member
 
jonbonazza's Avatar
 
Join Date: Jul 2010
Gender: Male
Posts: 1,935
 
Device(s): Nexus 4, Samsung Galaxy S II, HTC Evo 4G, Amazon Kindle Fire
Carrier: ATT

Thanks: 235
Thanked 482 Times in 294 Posts
Default

If there are errors in ANY of your resources, whether it be xml syntax, illegal file names, etc.., the R.java file will not be generated.
__________________
My blog, Inverted Keystrokes, is looking for aspiring developers (not necessarily with Android) to post articles. If you have any development experience and are interested in participating, please PM me. =)
jonbonazza is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 09:39 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.