Virat Bhavsar
Virat Bhavsar

Reputation: 11

R Class Error in my project

I get a R Class Error in my project. I tried cleaning the project, changing the property and restarting Eclipse.

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        applicationContext = this.getApplicationContext();
        eventData = new EventDataSQLHelper(this);

        btnforAway = (Button) findViewById(R.id.btnforAway);
        btnforDriving = (Button) findViewById(R.id.btnforDriving);
        txtDefaultmain = (TextView) findViewById(R.id.txtDefaultmain);

        btnforAway.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                AppMode = AWAY_MODE;

                launchAway();

            }
        });

here I get R.id Error in every file of my project

Upvotes: 0

Views: 314

Answers (2)

Android_dev
Android_dev

Reputation: 320

If there is any error in your resource folder ,R.java file will not generate automatically. Check your console for errors in your xml .And If you create any image in drawable folder with caps lock or numbers that time also R.java file is not generate automatically.

If there is no errors in Console follow these steps :

  1. Project==>uncheck Build automatically
  2. Project==>Clean
  3. Right click on project and select Build project
  4. Right click on project and select Android tools and select Fix project properties

Upvotes: 1

kodartcha
kodartcha

Reputation: 1073

Most of times R Class errors are related with wrong XML files build. Check all your layouts (XML files) for any error, tag or character not set properly, fix them and clean the project.

Upvotes: 0

Related Questions