Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

attribute is missing the android namespace prefix

Tags:

android

xml

Im creating an android app which uses a menu.xml file in the res folder. But I'm getting the above error. What does it mean? How can I fix it?

menu.xml:

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

<item id="@+id/my_location"
android:icon="@drawable/my_location"
android:title:="Current location" />

<item id="@+id/mapview_satellite"
android:icon="@drawable/satelliteview"
android:title="Satellite View" />

<item id="@+id/mapview_normal"
android:icon="@drawable/normalview"
android:title="Normal view" />
</menu>
like image 345
Kds23 Avatar asked Jan 05 '13 11:01

Kds23


2 Answers

Change <item id="@+id/my_location" to <item android:id="@+id/my_location". This in all three places.

Also, in here: android:title:="Current location" remove the colon after title.

like image 70
Boris Strandjev Avatar answered Oct 05 '22 23:10

Boris Strandjev


You also need to make sure the following two lines are in your attributes list:

xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"

If you omit those, Eclipse will just give you the "missing android prefix" error.

like image 23
Jack M Avatar answered Oct 06 '22 00:10

Jack M