user1527152
user1527152

Reputation: 956

premature end of file

I haven't found any solution, some people ask almost the same thing, but that doesn't help me.

So, I would like to define a menu for an Android appication.

I have create a folder named menu in "res" and when I create an xml file, I have an error :
"Premature end of file"

This error is on the first line of my xml file which is :

<?xml version="1.0" encoding="UTF-8"?>

And in the file I have only this other line :

<menu xmlns:android="http://schemas.android.com/apk/res/android"></menu>

In the console I have this error :

" Error in an XML file: aborting build. "

If anyone had the same problem or understand my problem can you help me, I don't understand what is wrong.

Upvotes: 3

Views: 4821

Answers (1)

Adinia
Adinia

Reputation: 3731

Try to add at least one item in the menu; for example:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/test"
        android:title="Test/>

</menu>

Upvotes: 2

Related Questions