 <p>You have to set up a root layout for your activity, which is holding the fragment in your xml code. Here is an example with a LinearLayout as a root layout:</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" android:name="com.google.android.gms.maps.MapFragment"/&gt; &lt;/LinearLayout&gt; </code></pre>