Reputation: 11
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
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 :
Project==>uncheck Build automatically
Project==>Clean
Build project
Android tools
and select Fix project properties
Upvotes: 1
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