sirFunkenstine
sirFunkenstine

Reputation: 8495

error with R.java. (cannot be resolved)

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?

Upvotes: 0

Views: 103

Answers (4)

sirFunkenstine
sirFunkenstine

Reputation: 8495

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.

Upvotes: 1

Valentin Grégoire
Valentin Grégoire

Reputation: 1150

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.

Upvotes: 0

Maria Niaz
Maria Niaz

Reputation: 107

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.

Upvotes: 0

Julio
Julio

Reputation: 483

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

Upvotes: 2

Related Questions