I have constantly gotten the same error over and over in my program and i can't find out how to fix it. R cannot be resolved to an error. I have tried to build my project and i have no imports that involve .R? Would anyone know how to fix it?
Here's my xml files i can't seem to find anything wrong....
strings.xml
Remote Doc
Remote Doc
Patient Mode
Doctor Mode
About
Exit
Simple Mode
Detailed Mode
About Remote Doc
\
Remote Doc is an application that allows a brace user analyze
how often they use their thing
main.xml
<!-- Patient Option -->
<Button android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/patientButton"
android:id="@+id/patientButton">
</Button>
<!-- Doctor Option -->
<Button android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/doctorButton"
android:layout_weight="1"
android:id="@+id/doctorButton">
</Button>
<!-- Exit Mode -->
<Button android:text="@string/exit"
android:layout_weight="1"
android:id="@+id/exit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></Button>
<!-- About Mode -->
<Button android:text="@string/aboutButton"
android:layout_weight="1"
android:id="@+id/aboutButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></Button>
</LinearLayout>
/>
main.xml- land
android:text="@string/mainTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="20dip"
android:textSize="24.5sp"/>
<TableLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:stretchColumns="*">
<TableRow>
<Button
android:text="@string/patientButton"
android:id="@+id/patientButton"/>
<Button
android:text="@string/doctorButton"
android:id="@+id/doctorButton"/>
</TableRow>
<TableRow>
<Button
android:text="@string/aboutButton"
android:id="@+id/aboutButton"/>
<Button
android:text="@string/exit"
android:id="@+id/exit"/>
</TableRow>
</TableLayout>
</LinearLayout>
This is a really common problem. First try cleaning your project by going to Project > Clean.
If that doesn't work, try one of the recommendations from this similar question
R is an automatically generated class in Android. It holds all your ressource references. Since the creation of that failed, you will most likely have an error inside one of your ressource files. (e.g. syntax error in a layout file like main.xml, or in your strings.xml). Check these files inside the res/ folder. Probably in the one you most recently edited.
After your are done and found it, this should go away automatically. Sometimes it gets stuck though, then do a project clean. Inside eclipse select Project->Clean.