2

I am not sure why this line is wrong below. The "R" is being underlined in red.

View view = LayoutInflater.from(mContext).inflate(android.support.v4.R.layout.user_item, viewGroup, false);

Error:

Cannot resolve symbol 'R'

Is this the correct version or do I have to change something? Thanks!

Laura Smith
  • 133
  • 9

3 Answers3

0

Try rebuilding the project and cleaning it. That usually fixes it. Also try syncing project with Gradle files. It's the little elephant at the top right.

Madhu Sharma
  • 562
  • 4
  • 9
0

If you defined the user_item layout yourself, you should just use R instead of android.support.v4.R.

0

enter image description here

write it as usual R.layout.user_item then place the cursor on red color R and press ALT+Enter this list will appear, click on import it will do the job.

and if it does not work then go to the project folder

enter image description here

delete these two Gradle files.

enter image description here

Click on this sync project with Gradle