'Android "Cannot resolve symbol '@id/myLabel"

I am getting an error saying "Cannot resolve symbol '@id/myLabel'". same error is for following elements:

"Cannot resolve symbol '@id/numberStudents'"
"Cannot resolve symbol '@id/accept'"

Please help me to resolve this issue. Sample of my xml is being pasted below.

Thanks, Abhilash Kadala.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TextView  
        android:id="@+id/myLabel"
        android:text="Name of student:"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
    />
    <EditText
        android:id="@+id/numberStudents"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/myLabel"
    />
    <Button
        android:id="@+id/accept"
        android:text="Accept"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/numberStudents"
        android:layout_alignParentRight="true"
        android:layout_marginLeft="10px"
    />
    <Button
        android:id="@+id/cancel"
        android:text="Cancel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@id/accept"
        android:layout_alignTop="@id/accept"
    />

</RelativeLayout>


Solution 1:[1]

Rebuild project has worked for me.

Solution 2:[2]

It's because you declaring id like this @+id/accept and using another place like this @id/accept.

Solution 3:[3]

try to reload all from disk [Ctrl + Alt + Y]

Solution 4:[4]

Try invalidate caches and restart , worked for me :)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 syed dastagir
Solution 2 Jay Rathod RJ
Solution 3 Vamsee.
Solution 4 Ayush Vatsal