Unbound Prefix in layout XML in com.google.android.gms.maps.MapView when try to add “map:…” attribute

I have a MapView (com.google.android.gms.maps.MapView, NOT using support) inside a LLayout. The MapView works perfectly fine, meaning I can see the map, I can zoom in and out. BUT when I try to add any of map:... attributes the compiler gives the error: unbound prefix.

I have google_play_services lib added to my project. My manifest has every necessary item added according to developers guide.

What am I missing? I Googled a lot but nothing worked for me.

Here is my fragment_map.XML

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

        <com.google.android.gms.maps.MapView
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        map:cameraTargetLat="-33.123456"
        />

</LinearLayout>

Here my manifest:

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="21" />

<permission 
    android:name="com.***.***.MAPS_RECEIVE"
    android:protectionLevel="signature">
</permission>
<uses-permission android:name="com.***.***.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>

<uses-feature 
    android:glEsVersion="0x00020000"
    android:required="true"/>


<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">
    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
    <activity
        android:name="com.***.***.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.***.***.ActivitySearchPropertyListing"
        android:label="@string/title_activity_activity_search_property_listing" >
    </activity>
    <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyCbMZNV8ylf0J3m16l6tUHJJLHP7EhTmRI"/>

</application>

</manifest>

My project Libraries and build path:

Answers


Quoting the documentation:

In order to use these custom attributes within your XML layout file, you must first add the following namespace declaration (you can choose any namespace, it doesn't have to be map):

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

You can then add the attributes with a map: prefix into your layout components, as you would with standard Android attributes.

You do not have this namespace declaration on your LinearLayout.


Need Your Help

Import logged in user disqus comments

javascript django authentication openid disqus

I have set up an openid logging in system for mysite and the famous disqus commenting system.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.