Android error - R cannot be resolved

Total Post:135

 1040  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.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

  1. Post:397

    Re: Android error - R cannot be resolved

    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

    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 Apr-09-2018 11:05:10 PM