Android Google Maps fragment in the xml. I get "Unexpected namespace prefix"

android, android-layout, google-maps-android-api-2, xml, xml-parsing

Solution

You have to do two things:

First: https://docs.google.com/document/pub?id=19nQzvKP-CVLd7_VrpwnHfl-AE9fjbJySowONZZtNHzw

Add the dependency to Google Play Services into your project

Project -> Properties -> Android -> Library, Add -> google-play-services_lib

Second: https://developers.google.com/maps/documentation/android/intro

Select `Project > Properties`, select `Java Build Path`, and navigate to `Libraries`. Select `Add External Jars`, include the following jar files, and click OK:

<android-sdk-folder>/extras/android/compatibility/v4/android-support-v4.jar

Now my project shows no errors anymore :)

Problem

I'm trying to learn android, and having followed the instructions on how to use the Google Maps API V.2 I now got it working. However, the instructions on how to configure the initial state of the maps, found at developers.google.com, suggests a namespace defined in the xml-file, in this case "map". The xml-code below gives med the error "Unexpected namespace prefix "map"". Trying to define the xmlns:map inside the fragment tag gave the same error but with "xmlns". I'm obviously missing some fundamental xml-knowledge here, can someone help me out? ``` <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:map="http://schemas.android.com/apk/res-auto" <!-- Definition --> 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:cameraBearing="112.5"/> <!-- PROBLEM --> </RelativeLayout> ```

Original source