Marty_01 Marty_01 - 1 year ago 183
Java Question

Cannot resolve symbol 'R'

I get this compiler error: Cannot resolve symbol 'R'. I know this question may seem familiar but many other questions related to this problem said that the code could compile despite the error while mine doesn't, or that the problem could be solved by cleaning the project and/or restarting Android Studio (I use 0.8.6), while in my case that doesn't work. Import class solves the compiler error but causes my app to crash when I start the activity. The code of the .java containing the error is:

import android.os.Bundle;

* Created by Me on 16-11-2014.
public class TutorialOne extends Activity {

protected void onCreate(Bundle savedInstanceState) {

I have also read that this may be caused by an error in the layout. Therefore I also include the code of the layout, which shows no compiler errors and is a pure pre-made layout:

<?xml version="1.0" encoding="utf-8"?>



Furthermore, Im following this tutorial: which uses an old version of Eclipse, can this be causing some kind of problem?

Thanks and sorry if this is still considered a duplicate post


Im just stupid and, when creating TutorialOne as class, I accidently created the class in the map java instead of com.something.something.

Answer Source

Check the generated build file Check the classes and package names.

There might be an issue with it. Rebuild the project from Project > Clean and then select the project you want to clean up. This will build your project and create a new bin folder and regenerate the file.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download