Red Cricket Red Cricket - 1 year ago 38
Android Question

Why is Android Studio complaining about android:layout_width and layout_height in my simple menu?

I have an app that builds just fine when I build it with

. But when I import the app into Android Studio, it gives me this error message. Geezzz I really wish I could cut-n-paste text from Android Studio :( so please excuse my screen shot.

enter image description here

Here's my menu.xml file:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="">
<!-- Single menu item
Set id, icon and Title for each menu item
<item android:id="@+id/menu_exit"
android:title="Exit" />


@Luksprog's comment The IDE it's complaining because you put your menu file inside the layout folder so the IDE thinks that is a layout file.

You should put menu file under res/menu/menu.xml

For more details about menu resource