Skip to main content
Added relevant tags
Link
Hitesh Sahu
  • 45.6k
  • 18
  • 217
  • 160
added 1 characters in body
Source Link
Peter Mortensen
  • 31.1k
  • 22
  • 111
  • 134

I just downloaded and installed the new Android SDK. I wanted to create a simple application to test drive it.

The wizard created this code:

package eu.mauriziopz.gps;

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

public class ggps extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

but Eclipse givegives me the error

R cannot be resolved

on line

setContentView(R.layout.main);

Why?

PS: I do have an XML file named main.xml under res/layout/.

I just downloaded and installed the new Android SDK. I wanted to create a simple application to test drive it.

The wizard created this code:

package eu.mauriziopz.gps;

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

public class ggps extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

but Eclipse give me the error

R cannot be resolved

on line

setContentView(R.layout.main);

Why?

PS: I do have an XML file named main.xml under res/layout/.

I just downloaded and installed the new Android SDK. I wanted to create a simple application to test drive it.

The wizard created this code:

package eu.mauriziopz.gps;

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

public class ggps extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

but Eclipse gives me the error

R cannot be resolved

on line

setContentView(R.layout.main);

Why?

PS: I do have an XML file named main.xml under res/layout/.

added 41 characters in body
Source Link
Peter Mortensen
  • 31.1k
  • 22
  • 111
  • 134
Loading
edited tags
Link
Jin35
  • 8.6k
  • 3
  • 35
  • 52
Loading
Post Made Community Wiki by sami
Question Protected by Bill the Lizard
deleted 4 characters in body; edited tags; edited title
Source Link
Yi Jiang
  • 50.2k
  • 16
  • 139
  • 137
Loading
Source Link
Maurizio Pozzobon
  • 3.1k
  • 7
  • 37
  • 45
Loading