Maurizio Pozzobon Maurizio Pozzobon - 3 months ago 12x
Android Question

R cannot be resolved - Android error

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.os.Bundle;

public class ggps extends Activity {
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {

but Eclipse gives me the error

R cannot be resolved

on line



PS: I do have an XML file named


What Will said was right

R is an automatically generated class that holds the constants used to identify your >resources. If you don't have an file (it would be gen/eu.mauriziopz.gps/ in >Eclipse with the 1.5 SDK) I would recommend closing and reopening your project or going to >Project > Build all (and selecting "Build Automatically" while there as recommended by >Josef). If that doesn't work than try making a new project, if the problem is recreated than >post here again and we'll go into more detail.

but I've found out that there was another problem that was causing the first one. The tools in the SDK directory didn't have the permissions to be executed, so it was like the didn't exist for Eclipse, thus it didn't build the file.

So modifying the permission and selecting "Build Automatically" solved the problem.