views:

22

answers:

1

Hi, Using Eclipse on win XP. I've previously created an app or 2, but am now working on the 'real' version and get the above error.

I was having funnies creating a 1.5 version, so have started a new project for 2.1.

package xxx.guest;

import android.R;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

public class briefme extends Activity {

 private String strURL;
           ........
           ........ 

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

Project as below (note I've removed some names for confidentiality reasons!)

Any ideas what's gone wrong?

Thanks,

Martin.

Project piccy here

A: 

I would try refreshing, if that doesnt work, close and open the project.

If those two fail, delete and re-create R(it should auto-generate)(copy it just to be on the safe side).

I've have this happen to me a few times and those are the three things I usually do to fix the error.

Edit: Also try changing your import:

import android.R;

to:

import you.package.R;

Or deleting that line.

James
OK, fixed it - (ggogle finally came up good :) )
martinm
> my project have include a r.java.at the beginning ,R.layout.main work good.But,after adding some code it doesn't work,and the error is R.layout.main can't resolved.what's the problem? >Look at your imports. Chances are that the line:import android.R;Taken from another Stackoverflow Q :will be there. If that's the case, remove it, so that your project will resolve R not with the default Android Resources class, but with the one auto-generated from your /res/ folder.
martinm