0

I am getting an error with my android eclipse SDK. It is saying that R cannot be resolved as a reference. I re-installed my sdk and created a new blank program.

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

}

Im still getting the same error. In previous posts i saw that sometimes android add's android.R as an import but i checked that and its not the case. Also checked my build path and that seems to be ok. Any ideas?

sirFunkenstine
  • 8,135
  • 6
  • 40
  • 57

4 Answers4

2

try to clean and rebuild your project.

a lot of times this can be due to a problem in an xml file so make sure all your xml files have correct syntax too

check this link out, its been asked a lot.

R cannot be resolved - Android error

Community
  • 1
  • 1
Julio
  • 483
  • 1
  • 4
  • 17
  • Oh ive tried that already. And setting build to automatic. Still not working. Im stumped. – sirFunkenstine Jun 11 '13 at 23:38
  • did you take a look at your xml file? also please look at the link, there are many answers that are sure to solve your problem – Julio Jun 11 '13 at 23:43
1

I figured it out. I dont know why this was an issue but i created a new workspace and everything corrected itself. Thanks for the help.

sirFunkenstine
  • 8,135
  • 6
  • 40
  • 57
0

Check your XML file for any error(s). Also see this post. It might help you:

https://stackoverflow.com/a/13462864/1368285

Best of Luck.

Community
  • 1
  • 1
Maria Niaz
  • 107
  • 1
  • 12
0

Also make sure you have the newest versions of everything. Run the SDK manager for updates. Indeed, a clean of your project is the most obvious solution, you tried that already. All XML files must be flawless. Also try to run the project blank. Then add part by part, and eventually you will come across a piece of code which has some sort of error in it.

Valentin Grégoire
  • 1,110
  • 2
  • 12
  • 29