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>
I have the same problem today. I upgraded the SDK last night and did not see this problem before. I had the Android Map V2 sample demo project loaded too and today the "multimap_demo.xml" file is showing the "Unexpected namespace prefix "map" found for tag fragment" error. I applied the xml include suggested and it is working again. Would give it a +1 but got no cred.
UPDATE: I forgot about this problem and reworked my code today and removed the include. Of course the error came back. I found this and added it to the layout in the fragment stanza:
It seems to at least mask the problem.
Update: This bug apparently happens due to a bug in Android Lint Tool. Refer issue https://code.google.com/p/gmaps-api-issues/issues/detail?id=5002
In my case a big miss, I forget to add in the gradle file my google map dependency:
I had this problem as well. I did Project/Clean and the error went away and it works fine now.