2

Trying to make some changes in XML file and new problem fired up:

Her's code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <fragment
        xmlns:map="http://schemas.android.com/apk/res/android"
        map:id="@+id/map"
        map:name="com.google.android.gms.maps.MapFragment"
        map:layout_width="wrap_content"
        map:layout_height="250dp" />

</LinearLayout>

Got error at

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

Unexpected namespace prefix "xmlns" for tag fragment

krzakov
  • 3,871
  • 11
  • 37
  • 52
  • But if both namespaces are same, why you want to declare it again? `xmlns:android` and `xmlns:android', both are referring same namespace `http://schemas.android.com/apk/res/android` – Vishal Pawale May 12 '13 at 20:24

2 Answers2

4

Not sure if I'm helpful here but i only declare the Namespace once in my case in the RelativeLayout

    <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" >

     <fragment class="com.blablabla.MyFragment"
            android:id="@+id/fragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
</RelativeLayout>

I dont declare the namespace again in the fragment as shown above. As far as I know the Namespace only has te be declared once in the parent ViewGroup

Ruben Weerts
  • 313
  • 1
  • 6
0

If I had to guess, you are most likely running into this bug in the build tools.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • So there's no way to achieve that - Map and e.g TextView in the same activity? – krzakov May 12 '13 at 20:23
  • If there's a bug how the hell app named "Endomondo sports tracker" using maps and other stuff on same activity? – krzakov May 12 '13 at 20:25
  • 3
    @krzakov: "So there's no way to achieve that - Map and e.g TextView in the same activity?" -- sure. Just don't use `xmlns:map`, setting the values in Java instead. "If there's a bug how the hell app named "Endomondo sports tracker" using maps and other stuff on same activity?" -- perhaps they have developers that use less profanity. – CommonsWare May 12 '13 at 20:30