Independent_Pie6058
Independent_Pie6058

Reputation: 43

getMenuInflater().inflate(R.menu.main, menu); Cannot resolve symbol 'main'

Hoping you can help me. I'm new to android and have been following a tutorial for music player but I'm getting this error: Cannot resolve symbol 'main' on the line getMenuInflater().inflate(R.menu.main, menu); (word: main). I'm so new to android and android studio.

Originally, the error was on the word 'menu' and I found this and this and I just followed it, but now I'm getting an error for the word 'main'.

enter image description here

Thanks in advance!

Upvotes: 0

Views: 2054

Answers (1)

Ezekiel Sebastine
Ezekiel Sebastine

Reputation: 248

main should match an XML file that contains the layout for the menu. It is usually in the res/menu folder. Expand that folder and you should see the menu file. By the way, it's most likely menu_main and not main So try changing main to menu_main in your code and see if the error goes away

Upvotes: 1

Related Questions