Home > DeveloperSection > Forums > Android error - R cannot be resolved
Chintoo Semi

Total Post:135

Posted on    May-20-2015 12:07 AM

 Android Android  Android Activity 

 1 Reply(s)
 638  View(s)
Rate this:
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. */
    public void onCreate(Bundle savedInstanceState) {
but Eclipse gives me the error

R cannot be resolved
on line


Mayank Tripathi
Mayank Tripathi

Total Post:397

Posted on    May-20-2015 7:04 AM

R is an automatically generated class that holds the constants used to identify your >resources. If you don't have an R.java file (it would be gen/eu.mauriziopz.gps/R.java 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 R.java file.

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

Each time I had a problem with R not been generated, or even disappeared, this was due to some problem in the XML layout file that prevented the application from being built.

Modified On May-20-2015 07:04:58 AM

Don't want to miss updates? Please click the below button!

Follow MindStick