This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

R cannot be resolved to a variable , syntax errors in program that was working fine day before

 
Sam Acropolis
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Line 15 and 22 complain that
R cannot be resolved to a variable


I have tried removing the

statement and even renaming it to import com.HelloWorld.firstandroidproject.R;

but the syntax errors still persist ...

any ideas?


Thanks a bunch everyone


 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should not have to import anything, it should just work - how are you building the project? The R.java (and R.class) files are generated automatically, and part of the package that's listed in AndroidManifest.xml - which in your case should be "com.example.firstandroidproject", not "com.HelloWorld.firstandroidproject".
 
Sam Acropolis
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My package name is as you say it com.example.firstandroidproject;

Im pretty much creating a android virtual device and then attempting to launch it , I have even tried 'cleaning' the project to from the 'project' menu in eclipse.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!