error on lines:
setContentView(R.layout.activity_main);
getMenuInflater().inflate(R.menu.activity_main, menu);

error: ----- R cannot be resolved to a variable

package com.example.android_01;




import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.EditText;


public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}




@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}

note i also tried importing:

import com.example.android_01.R;

but didnt worked.

i than try adding:

import android.R;

but than i got another error:" activity_main cannot be resolved or is not a field" on line:

setContentView(R.layout.activity_main);

check for updates than this issue will be resolved.Also don;t import R of import android.R;
If it is there than just remove it.
I also faced similar issue.I got it resolved by updating android version.

Select Project from the menu then Clean>>Build automatically if you're using Eclipse