I have come across code like this in many maps examples:
<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=".MainActivity" >
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
</RelativeLayout>
However, for them all, it goes that I get error
Description Resource Path Location Type Unexpected namespace prefix "xmlns" found for tag fragment activity_msmap.xml /example/res/layout line 8 Android Lint Problem
At line
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
So... What is going on here? I see it in examples everywhere, but it causes error in my Eclipse/Android? Also, why repeat the same xml namespace when it is also defined in the parent element?
You can't define a namespace twice in an xml layout. Just remove it from your fragment, the RelativeLayout already defines the xmlns:android namespace.
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With