2

Possible Duplicate:
R cannot be resolved to a variable - Hello World

I was developing my first app but get stuck on mainactivity.java.

Here is my code:

package com.nterface;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;

public class MainActivity extends Activity {

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

    /** Called when the user clicks the Send button */
    public void sendMessage(View view) {
        // Do something in response to button
    }

}

An error occurs on line setContentView(R.layout.activity_main);

Multiple markers at this line:

  • R cannot be resolved to a variable
  • Line breakpoint:MainActivity [line: 12]- onCreate(Bundle)
Community
  • 1
  • 1
Saif Kazi
  • 67
  • 3
  • 9

2 Answers2

1

First Clean your project and then run.If not effected then Once restart your eclipse and clean the project and Run it. If not then go through the following link.

Harish
  • 3,122
  • 2
  • 31
  • 46
0

You should import your R.java, it should be in com.nterface.R

Nermeen
  • 15,883
  • 5
  • 59
  • 72