Search code examples
androidmapsmarkerflat

Android maps V2 - The method flat(boolean) is undefined for the type MarkerOptions


I have an android app with Android Maps V2. Adding markers to it is no problem but I can't seem to make the marker flat. When I use this piece of example code

Marker marker = map.addMarker(new MarkerOptions()
                    .position(new LatLng(50, 50))
                    .flat(true));

it gives me the error The method flat(boolean) is undefined for the type MarkerOptions.

I have the following in my manifest

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />

and

    <meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" />

I can't seem to find why it behaves like flat markers don't exist. Any help would be appreciated. Thanks in advance.


Solution

  • You must be using an older version of the Play Services SDK. Download the latest from the SDK Manager, then make sure that your project is using this latest version.