The app I am developing has many activities organized into seven java packages. Originally I wrote all the coding and stuff for each group of activities in a java package as
Check that the layout -> main.xml file is correct and includes the android:id="@+id/whateverIdHasCausedYouTheError"
android:id="@+id/whateverIdHasCausedYouTheError"
The R.java file will then be updated to include the id.. and bam, your error should disappear.