Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unexpected namespace prefix "xmlns" found for tag fragment Unexpected namespace prefix "map" found for tag fragment

why Unexpected namespace prefix "xmlns" found for tag fragment
Unexpected namespace prefix "map" found for tag fragment?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Main">

    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:map="http://schemas.android.com/apk/res-auto"
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.MapFragment"

        map:mapType="satellite"/>
</RelativeLayout>

why Unexpected namespace prefix "xmlns" found for tag fragment Unexpected namespace prefix "map" found for tag fragment ?

like image 635
Mr.Strolling Avatar asked May 09 '13 11:05

Mr.Strolling


2 Answers

Remove xmlns:android="http://schemas.android.com/apk/res/android" from the <fragment> element, and consider moving xmlns:map="http://schemas.android.com/apk/res-auto" from the <fragment> element to the root element.

For example, this is valid:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    android:id="@+id/foo"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.SupportMapFragment"
        map:mapType="satellite"/>

</RelativeLayout>
like image 62
CommonsWare Avatar answered Oct 16 '22 00:10

CommonsWare


Obviously this is just a mis-lead Lint check error. You can remove it when, in Eclipse's Problem view, you right-click the line with the error, select the Quick fix option and select e.g. Ignore Check for project.

The error goes away, the project builds and the app runs perfectly well.

like image 40
Ridcully Avatar answered Oct 15 '22 22:10

Ridcully